public interface ClassFile
ClosureCompilerImpl
for closure computation. The
interface only represents the information as needed by api scanning feature
in verifier. I expect it to evolve over time to something very similar to
BCEL's ClassFile. Now a note about different ways a Java class can be named
and in different places different names are used for the same Java class. 1)
In the format "p.a.b". This is what we use when declaring variables etc in a
Java code. I do not use this because this is not an unambiguous
representation of a Java class. By looking at p.a.b it is not possible to say
if b is an inner class in class p.a or b is an outer class in package p.a. 2)
In the format "p.outer$inner". It is what is used when we invoke java command
or Class.forName(). It is same as what is returned by
java.lang.Class.getName() method. It is an unambiguous representation of a
class name, because by looking at it, we can tell "inner" is an inner class
of a class "outer" which belongs to package p. By default our getName()
returns in this format. 3) In the format "p/outer$inner" This is
the internal name of a class. It is called internal name because in byte code
this is what is encoded. It is again an unambiguous representation as this a
path expression. It is fairly simple to convert from 2 to 3 by a simple call
to String.replace('.','/'). Similarly to convert from 3 to 2, call
String.replace('/','.'); Here is a test of what you understood. What does
this class name "a$b.c$d.Foo$Bar$Goo" mean? "Goo" is an inner class in a
class "Foo$Bar" which is defined in a package "a$b.c$d".Modifier and Type | Method and Description |
---|---|
Collection<String> |
getAllReferencedClassNames() |
Collection |
getAllReferencedClassNamesInInternalForm() |
String |
getInternalName() |
String |
getInternalNameOfSuperClass() |
String[] |
getInternalNamesOfInterfaces() |
Method |
getMethod(MethodRef methodRef) |
Collection<? extends Method> |
getMethods() |
String |
getName() |
String |
getNameOfSuperClass() |
String[] |
getNamesOfInterfaces() |
String |
getPackageName() |
boolean |
isInterface() |
boolean |
isPublic() |
Collection<String> getAllReferencedClassNames()
Collection getAllReferencedClassNamesInInternalForm()
String getName()
getInternalName()
String getInternalName()
String getPackageName()
Collection<? extends Method> getMethods()
Method getMethod(MethodRef methodRef)
methodRef
- is the reference of the method that is being looked forString getNameOfSuperClass()
String getInternalNameOfSuperClass()
String[] getNamesOfInterfaces()
String[] getInternalNamesOfInterfaces()
boolean isInterface()
boolean isPublic()
Copyright © 2009–2023 Oracle Corporation. All rights reserved.