You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version of JMockit that was used:
1.41 and 1.43
maven 3.3.9 or 3.2.5
Java 1.8.0_181
Description of the problem:
A test adds an expectation which involves a class called Person.class
This has a property like this @RestApiField(metaDataName = FieldDefinitionConsts.FIELD_DEFINITION_CAN_BE_USER, getterMethod = "isCanBeUser", fieldType = boolean.class) private String canBeUser = StringUtil.FALSE;
The property fieldtype is defined as Class<?> fieldType() default Null.class;
This results in an IllegalArgumentException java.lang.IllegalArgumentException: Invalid type descriptor: Z
if the test is executed via maven (see stack below)
strangely in my Ecplise IDE it works.
If I change the fieldType property to Boolean.class it works.
In case of the primitive class type boolean.class the internal "strings" array contains this Z (which indicated a primitive boolean): ... canBeUser, CanBeUser, getterMethod, isCanBeUser, fieldType, Z, canbeuser, ....
Should the method mockit.asm.ReferenceType.getReferenceType(char[], int)
Also support the primitive Class types
I quickly created a testcase which reflects our environment.
Within the latest jmockit checkout execution fails (also in my IDE now :-) ) BooleanPrimitiveTest.zip
Thx for support
Markus Lutum
Version of JMockit that was used:
1.41 and 1.43
maven 3.3.9 or 3.2.5
Java 1.8.0_181
Description of the problem:
A test adds an expectation which involves a class called Person.class
This has a property like this
@RestApiField(metaDataName = FieldDefinitionConsts.FIELD_DEFINITION_CAN_BE_USER, getterMethod = "isCanBeUser", fieldType = boolean.class)
private String canBeUser = StringUtil.FALSE;
The property fieldtype is defined as
Class<?> fieldType() default Null.class;
This results in an IllegalArgumentException
java.lang.IllegalArgumentException: Invalid type descriptor: Z
if the test is executed via maven (see stack below)
strangely in my Ecplise IDE it works.
If I change the fieldType property to Boolean.class it works.
In case of the primitive class type boolean.class the internal "strings" array contains this Z (which indicated a primitive boolean):
... canBeUser, CanBeUser, getterMethod, isCanBeUser, fieldType, Z, canbeuser, ....
Should the method
mockit.asm.ReferenceType.getReferenceType(char[], int)
Also support the primitive Class types
The Stack
Thread [main] (Suspended (exception IllegalArgumentException)) ReferenceType.getReferenceType(char[], int) line: 54 ReferenceType.createFromTypeDescriptor(String) line: 38 AnnotationReader.readClassInfo(String, AnnotationVisitor) line: 102 AnnotationReader.readAnnotationValue(String, AnnotationVisitor) line: 57 AnnotationReader.readAnnotationValues(int, boolean, AnnotationVisitor) line: 33 AnnotationReader.readAnnotationValues(boolean, AnnotationVisitor) line: 27 AnnotationReader.readNamedAnnotationValues(int, AnnotationVisitor) line: 21 FieldReader(AnnotatedReader).readAnnotationValues(AnnotationVisitor) line: 80 FieldReader(AnnotatedReader).readAnnotations(BaseWriter) line: 72 FieldReader.readField() line: 40 FieldReader.readFields() line: 23 ClassReader.readFieldsAndMethods() line: 220 ClassReader.accept(ClassVisitor, int) line: 121 ClassReader.accept(ClassVisitor) line: 94 CascadingTypeRedefinition(BaseTypeRedefinition).redefineClass(Class<?>, ClassReader, MockedClassModifier) line: 211 CascadingTypeRedefinition(BaseTypeRedefinition).redefineClassAndItsSuperClasses(Class<?>) line: 188 CascadingTypeRedefinition(BaseTypeRedefinition).redefineClassAndItsSuperClasses(Class<?>) line: 204 CascadingTypeRedefinition(BaseTypeRedefinition).redefineMethodsAndConstructorsInTargetType() line: 175 CascadingTypeRedefinition(BaseTypeRedefinition).redefineTargetClassAndCreateInstanceFactory(Type) line: 251 CascadingTypeRedefinition(BaseTypeRedefinition).redefineType(Type) line: 67 CascadingTypeRedefinition.redefineType() line: 21 MockedTypeCascade.createNewCascadedInstanceOrUseNonCascadedOneIfAvailable(String, Type) line: 274 MockedTypeCascade.getCascadedInstance(String, String, Object) line: 224 MockedTypeCascade.getMock(String, String, Object, String, String) line: 98 ExpectedInvocation.getDefaultValueForReturnType() line: 379 RecordPhase.handleInvocation(Object, int, String, String, String, boolean, Object[]) line: 57 RecordAndReplayExecution.recordOrReplay(Object, int, String, String, String, int, Object[]) line: 170 $Impl_PersonLister.findVisitorByVisit(VisitDetails) line: not available VisitConverterTest$9.<init>(VisitConverterTest, VisitDetails, Visitor, AuthorisationOnline) line: 470 VisitConverterTest.viewTestDetailsWithAuthorizationsOneEntry() line: 468 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 498 FrameworkMethod$1.runReflectiveCall() line: 50 FrameworkMethod$1(ReflectiveCallable).run() line: 12 FrameworkMethod.invokeExplosively(Object, Object...) line: 47 JUnit4TestRunnerDecorator.executeTestMethod(FakeInvocation, Object, Object...) line: 154 JUnit4TestRunnerDecorator.invokeExplosively(FakeInvocation, Object, Object...) line: 70 FakeFrameworkMethod.invokeExplosively(Invocation, Object, Object...) line: 33 <unknown receiving type>(FrameworkMethod).invokeExplosively(Object, Object...) line: 47 InvokeMethod.evaluate() line: 17 RunBefores.evaluate() line: 26 JMockit(ParentRunner<T>).runLeaf(Statement, Description, RunNotifier) line: 325 JMockit(BlockJUnit4ClassRunner).runChild(FrameworkMethod, RunNotifier) line: 78 JMockit(BlockJUnit4ClassRunner).runChild(Object, RunNotifier) line: 57 ParentRunner$3.run() line: 290 ParentRunner$1.schedule(Runnable) line: 71 JMockit(ParentRunner<T>).runChildren(RunNotifier) line: 288 ParentRunner<T>.access$000(ParentRunner, RunNotifier) line: 58 ParentRunner$2.evaluate() line: 268 RunBefores.evaluate() line: 26 JMockit(ParentRunner<T>).run(RunNotifier) line: 363 JUnit4Provider.execute(Class<?>, Notifier, Filter) line: 365 JUnit4Provider.executeWithRerun(Class<?>, Notifier) line: 273 JUnit4Provider.executeTestSet(Class<?>, RunListener, Notifier) line: 238 JUnit4Provider.invoke(Object) line: 159 ForkedBooter.invokeProviderInSameClassLoader(ForkingReporterFactory) line: 383 ForkedBooter.runSuitesInProcess() line: 344 ForkedBooter.execute() line: 125 ForkedBooter.main(String...) line: 417
The text was updated successfully, but these errors were encountered: