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

ClassPool.makePackage alternative for for Java11 #246

Closed
vamsi360 opened this issue Feb 11, 2019 · 5 comments
Closed

ClassPool.makePackage alternative for for Java11 #246

vamsi360 opened this issue Feb 11, 2019 · 5 comments

Comments

@vamsi360
Copy link

Hi,

We were using classPool.makePackage(currClassLoader, ctClass.getPackageName()) in our code to create a package at runtime.

This is deprecated in Java9+. What is the recommended way of achieving this in Java11? Could you point me to the resources on how to fix this?

@vamsi360
Copy link
Author

Note: Adding --add-opens java.base/java.lang=ALL-UNNAMED (as described in javadocs) in VM options also doesn't seem to work for me in JDK11

@NingZhang-e
Copy link
Contributor

Seems the java doc in ClassPool is incorrect and needs to be update:

* <p>The jigsaw module introduced by Java 9 has broken this method.

Due to it will not be supported in Java9+:
throw new RuntimeException("define package has been disabled for jigsaw");

NingZhang-e added a commit to NingZhang-e/javassist that referenced this issue Feb 12, 2019
@NingZhang-e
Copy link
Contributor

One PR to update java doc:
#247

@vamsi360
Copy link
Author

hi @NingZhang-e
how to makePackage now at runtime going forward? How to migrate existing code? Is there any other way?

@NingZhang-e
Copy link
Contributor

I can not figure out a graceful way to go forward. Because define new package conflict with jigsaw policy.
Suggest to abandon make package usage if you want to uplift to Java9+. And make class under one existing package, e.g. org.javassist.

odl-github pushed a commit to opendaylight/odlparent that referenced this issue Oct 10, 2019
3.25 fixes:
- jboss-javassist/javassist#72
- jboss-javassist/javassist#241
- jboss-javassist/javassist#242
- jboss-javassist/javassist#246
- jboss-javassist/javassist#252
3.26 fixes:
- jboss-javassist/javassist#265
- jboss-javassist/javassist#270
- jboss-javassist/javassist#271
- jboss-javassist/javassist#275

Of these #270 is most important, as it fixes an issue we've seen
with powermock downstream.

Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
odl-github pushed a commit to opendaylight/odlparent that referenced this issue Oct 17, 2019
3.25 fixes:
- jboss-javassist/javassist#72
- jboss-javassist/javassist#241
- jboss-javassist/javassist#242
- jboss-javassist/javassist#246
- jboss-javassist/javassist#252
3.26 fixes:
- jboss-javassist/javassist#265
- jboss-javassist/javassist#270
- jboss-javassist/javassist#271
- jboss-javassist/javassist#275

Of these #270 is most important, as it fixes an issue we've seen
with powermock downstream.

Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6a404f1)
odl-github pushed a commit to opendaylight/odlparent that referenced this issue Oct 17, 2019
3.25 fixes:
- jboss-javassist/javassist#72
- jboss-javassist/javassist#241
- jboss-javassist/javassist#242
- jboss-javassist/javassist#246
- jboss-javassist/javassist#252
3.26 fixes:
- jboss-javassist/javassist#265
- jboss-javassist/javassist#270
- jboss-javassist/javassist#271
- jboss-javassist/javassist#275

Of these #270 is most important, as it fixes an issue we've seen
with powermock downstream.

Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6a404f1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants