Closed mkonstantinou closed 7 years ago
I believe i'm having a similar problem with an enum class we're using:
java.lang.AssertionError: [PojoFieldImpl [field=private static int[] net.company.model.MyClass.$SWITCH_TABLE$net$company$MyEnum, fieldGetter=null, fieldSetter=null]] is missing a getter
at org.junit.Assert.fail(Assert.java:88)
at com.openpojo.validation.affirm.JUnitAssertAffirmation.fail(JUnitAssertAffirmation.java:38)
at com.openpojo.validation.affirm.Affirm.fail(Affirm.java:47)
at com.openpojo.validation.rule.impl.GetterMustExistRule.evaluate(GetterMustExistRule.java:38)
at com.openpojo.validation.utils.ValidationHelper.runValidation(ValidationHelper.java:91)
at com.openpojo.validation.impl.DefaultValidator.validate(DefaultValidator.java:46)
at com.openpojo.validation.impl.DefaultValidator.validate(DefaultValidator.java:51)
at com.openpojo.validation.impl.DefaultValidator.validate(DefaultValidator.java:57)
at net.apmoller.crb.portal.ssib.PojoValidation.testPojoStructureAndBehavior(PojoValidation.java:25)
at net.apmoller.crb.portal.ssib.location.LocationModelTest.testPojoStructureAndBehavior(LocationModelTest.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
The $SWITCH_TABLE$ issue depends on the JDK. The Oracle JDK (at least 1.8.0_45 and 1.8.0_102) produce the error, while OpenJDK does not.
Making PojoFieldFactory
exclude synthetic fields (or ignoring them during validation) should fix this issue.
Classes and methods also have a "synthetic" property, which might cause similar issues.
For a subclass SortOrder of class RankResourceObject...
the variable multipleSortOrders is a parameter of a function with the following footprint:
public static Comparator<RankingResourceObject> combineSortOrders(final SortOrder... multipleSortOrders)