Is there a way in Java to access type information at runtime without fully loading the class?

I am trying to get a link to java.lang.Class, which is on my class path and is viewing elements on it with reflection. The problem is that I am trying to do this only with an incomplete class. By this I mean that the classpath contains all the classes that interest me, but does not necessarily contain additional classes on which these classes may depend. Therefore, it is not possible to fully load a class in the usual way.

Is it possible?

+3
source share
5 answers

You can use ASM to parse a file .classwithout loading a class

+2
source

, ClassNotFound, . , , , , .
, - , .

+2

, , , , static ( ) .

+1

, , (, , ), , , .

, , , , . , , ( , ), , .

0

"" . ( , 5 , ).

, ( , URL- ), .

. .

classloader , "" classpath. , bootstrap.

, , . , , .

0

Source: https://habr.com/ru/post/1729910/


All Articles