Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not access package scope class #629

Open
hantsy opened this issue Nov 9, 2023 · 1 comment
Open

Can not access package scope class #629

hantsy opened this issue Nov 9, 2023 · 1 comment
Labels
bug Something isn't working right

Comments

@hantsy
Copy link

hantsy commented Nov 9, 2023

Describe the bug
The test class was working before, but failed in the latest update.

To Reproduce

The class is an inner class in the test, which is working well before, but now I got an exception of field access error.

Error:  com.example.demo.JdkLocalDateTimeJsonSerDeserTest.testSeAndDes -- Time elapsed: 0.118 s <<< ERROR!
jakarta.json.bind.JsonbException: Error accessing getter 'getOccured' declared in 'class com.example.demo.TestObject'
	at org.eclipse.yasson.internal.model.PropertyModel.createReadHandle(PropertyModel.java:513)
	at org.eclipse.yasson.internal.model.PropertyModel.<init>(PropertyModel.java:157)
	at org.eclipse.yasson.internal.ClassParser.lambda$parseProperties$0(ClassParser.java:70)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1787)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at org.eclipse.yasson.internal.ClassParser.parseProperties(ClassParser.java:71)
	at org.eclipse.yasson.internal.MappingContext.lambda$createParseClassModelFunction$1(MappingContext.java:105)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at org.eclipse.yasson.internal.MappingContext.getOrCreateClassModel(MappingContext.java:77)
	at org.eclipse.yasson.internal.serializer.SerializationModelCreator.serializerChain(SerializationModelCreator.java:93)
	at org.eclipse.yasson.internal.SerializationContextImpl.getRootSerializer(SerializationContextImpl.java:208)
	at org.eclipse.yasson.internal.SerializationContextImpl.serializeObject(SerializationContextImpl.java:196)
	at org.eclipse.yasson.internal.SerializationContextImpl.marshall(SerializationContextImpl.java:133)
	at org.eclipse.yasson.internal.SerializationContextImpl.marshall(SerializationContextImpl.java:159)
	at org.eclipse.yasson.internal.JsonBinding.toJson(JsonBinding.java:131)
	at com.example.demo.JdkLocalDateTimeJsonSerDeserTest.testSeAndDes(JdkLocalDateTimeJsonSerDeserTest.java:44)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	Suppressed: jakarta.json.stream.JsonGenerationException: Generating incomplete JSON
		at org.eclipse.parsson.JsonGeneratorImpl.close(JsonGeneratorImpl.java:521)
		at org.eclipse.yasson.internal.JsonBinding.toJson(JsonBinding.java:130)
		... 4 more
Caused by: java.lang.IllegalAccessException: class is not public: com.example.demo.TestObject.getOccured[Ljava.lang.Object;@63813085/invokeVirtual, from public Lookup
	at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:894)
	at java.base/java.lang.invoke.MethodHandles$Lookup.checkAccess(MethodHandles.java:3987)
	at java.base/java.lang.invoke.MethodHandles$Lookup.checkMethod(MethodHandles.java:3923)
	at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:4072)
	at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(MethodHandles.java:4065)
	at java.base/java.lang.invoke.MethodHandles$Lookup.unreflect(MethodHandles.java:3451)
	at org.eclipse.yasson.internal.model.PropertyModel.createReadHandle(PropertyModel.java:510)
	... 23 more

Expected behavior

I should work as before.

System information:

  • OS: Github actions Ubuntu
  • Java Version: 21
  • Yasson Version: Quarkus 3.5.1 built-in
@hantsy hantsy added the bug Something isn't working right label Nov 9, 2023
@hantsy hantsy changed the title Can not package scope Class Can not access package scope class Nov 9, 2023
@hantsy
Copy link
Author

hantsy commented Mar 27, 2024

Any update here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right
Projects
None yet
Development

No branches or pull requests

1 participant