Sigtest get the value of public static final fields even though the constant checking is off, which force unnecessary class initialization. For example:
==========
public class A {
public final static int CONST = 0;
static {
System.out.println("*Class initialized*");
}
}
===========
SignatureTest report
Tested version:
Check mode: src [throws normalized]
Constant checking: off
^^^
constant checking is off
*Class initialized*
STATUS:Passed.
Java Result: 95
In general, the sigtest should not initialize classes in the reflection mode if constant checking is switched off.
Sigtest does not initialize classes in the reflection mode at all, java does it:
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
at java.lang.reflect.Field.get(Field.java:357)
at com.sun.tdk.signaturetest.loaders.TigerRefgClassDescrLoader.readFields(TigerRefgClassDescrLoader.java:138)
at com.sun.tdk.signaturetest.loaders.TigerRefgClassDescrLoader.readClass(TigerRefgClassDescrLoader.java:106)
at com.sun.tdk.signaturetest.loaders.TigerRefgClassDescrLoader.load(TigerRefgClassDescrLoader.java:51)
at com.sun.tdk.signaturetest.core.ClassHierarchyImpl.load(ClassHierarchyImpl.java:155)
at com.sun.tdk.signaturetest.core.ClassHierarchyImpl.load(ClassHierarchyImpl.java:151)
at com.sun.tdk.signaturetest.SignatureTest.verifyClass(SignatureTest.java:858)
at com.sun.tdk.signaturetest.SignatureTest.check(SignatureTest.java:683)
at com.sun.tdk.signaturetest.SignatureTest.run(SignatureTest.java:243)
at com.sun.tdk.signaturetest.SignatureTest.main(SignatureTest.java:212)
Yes, sigtest reads constant values even if they are unnecessary. And the problem is there. Sigtest architecture is "light-coupled" and "readers" read all possible data. Later some of read information will be used by other modules but some just ignored. This is very rignt approuch but probably we have pass mode to reade for this particular case.
==========
public class A {
public final static int CONST = 0;
static {
System.out.println("*Class initialized*");
}
}
===========
SignatureTest report
Tested version:
Check mode: src [throws normalized]
Constant checking: off
^^^
constant checking is off
*Class initialized*
STATUS:Passed.
Java Result: 95
In general, the sigtest should not initialize classes in the reflection mode if constant checking is switched off.
Sigtest does not initialize classes in the reflection mode at all, java does it:
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
at java.lang.reflect.Field.get(Field.java:357)
at com.sun.tdk.signaturetest.loaders.TigerRefgClassDescrLoader.readFields(TigerRefgClassDescrLoader.java:138)
at com.sun.tdk.signaturetest.loaders.TigerRefgClassDescrLoader.readClass(TigerRefgClassDescrLoader.java:106)
at com.sun.tdk.signaturetest.loaders.TigerRefgClassDescrLoader.load(TigerRefgClassDescrLoader.java:51)
at com.sun.tdk.signaturetest.core.ClassHierarchyImpl.load(ClassHierarchyImpl.java:155)
at com.sun.tdk.signaturetest.core.ClassHierarchyImpl.load(ClassHierarchyImpl.java:151)
at com.sun.tdk.signaturetest.SignatureTest.verifyClass(SignatureTest.java:858)
at com.sun.tdk.signaturetest.SignatureTest.check(SignatureTest.java:683)
at com.sun.tdk.signaturetest.SignatureTest.run(SignatureTest.java:243)
at com.sun.tdk.signaturetest.SignatureTest.main(SignatureTest.java:212)
Yes, sigtest reads constant values even if they are unnecessary. And the problem is there. Sigtest architecture is "light-coupled" and "readers" read all possible data. Later some of read information will be used by other modules but some just ignored. This is very rignt approuch but probably we have pass mode to reade for this particular case.