java - Does a ClassLoader load a complete package when there is a wildcard? -
how java classloader load imports import java.util.*
? asking, because have custom classloader asked load package instead of class. example:
public class<?> loadclass(string classname) throws classnotfoundexception { system.out.println(classname); return parent.loadclass(classname); }
example output:
org.test.model.user org.test.model org.test.model
so seems whole package requested (may due import org.test.model.*
?) not sure if imports causing (and how handle it) or if fine , should way. in advance!
note: question seems root of actual problem.
edit out of answer below understand classes loaded when referenced , import
statement not important. anyhow, why packages (like "org.test.model
" in example above) being loaded? or such request mean?
'import' syntactic sugar. when code gets compiled bytecode, classes referenced complete package.name
Comments
Post a Comment