Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining java classes without a name

Tags:

java

syntax

I'm reading this research paper about a bug in an older JVM (Java 2 SDK 1.2). It declares a few classes like this

public class <Sup,L> {
    public int f = 1;
}

and this

public class <java.lang.String,L> {
    public int f = 1;
}

What does this syntax mean? Are these two classes called Sup and java.lang.String, are they generics, or is something else going on? Eclipse highlights the class decelerations with "Syntax error on tokens, InterfaceHeader expected instead."

like image 391
David Avatar asked Aug 01 '26 08:08

David


1 Answers

from a brief browsing of the document, I understood that this is a schematic representation of Class and classLoder. "schematic" means that class <Sup,L> is the format that the author chose to mean "Class Sup that was loaded by Class Loader L" this is not meant to be a JLS complient syntax.

like image 73
Sharon Ben Asher Avatar answered Aug 04 '26 00:08

Sharon Ben Asher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!