If a class is compiled that does not have a package statement but is mistakenly loaded in Javassist as though it did have a package statement then Javassist will not detect this error and find the class and some methods will give incorrect results but not thow an exception whilst others will throw an exceptoion. EG:
// NoPackage.java - note no package statement public class NoPackage {}
// NoPackageTest.java - note has package statement package examples.javassisttests; import javassist.*; public class NoPackageTest { public static void main( final String[] notUsed ) throws NotFoundException { final CtClass noPackage = ClassPool.getDefault().get( "examples.javassisttests.NoPackage" ); System.out.println( "package = " + noPackage.getPackageName() ); System.out.println( "modifiers = " + noPackage.getModifiers() ); } }