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

sun.awt.image.ByteInterleavedRaster gone in Java 9? #62

Closed
andrewbaxter opened this issue Mar 2, 2017 · 10 comments
Closed

sun.awt.image.ByteInterleavedRaster gone in Java 9? #62

andrewbaxter opened this issue Mar 2, 2017 · 10 comments

Comments

@andrewbaxter
Copy link

First of all, thanks for this library!

I'm getting this with Java 9 early access:

Exception in thread "main" java.lang.IllegalAccessError: class boofcv.io.image.ConvertBufferedImage (in unnamed module @0x53ce1329) cannot access class sun.awt.image.ByteInterleavedRaster (in module java.desktop) because module java.desktop does not export sun.awt.image to unnamed module @0x53ce1329
	at boofcv.io.image.ConvertBufferedImage.convertFrom(ConvertBufferedImage.java:389)
	at boofcv.io.image.ConvertBufferedImage.convertFromSingle(ConvertBufferedImage.java:295)
@andrewbaxter
Copy link
Author

Not sure if it helps but this compiles in Java 9:

byte[] pixels = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData();a

(http://stackoverflow.com/questions/6524196/java-get-pixel-array-from-image)

and

bufferedImage.getRaster().getNumBands();
((ComponentSampleModel)bufferedImage.getRaster().getSampleModel()).getScanlineStride();

etc

@andrewbaxter
Copy link
Author

Actually, now I can't compile due to references to missing classes

ByteInterleavedRaster
IntegerInterleavedRaster
ShortInterleavedRaster
SunWritableRaster

I made shims and switched to the slow converters and everything's working for the moment.

@lessthanoptimal
Copy link
Owner

I really hope they didn't remove those classes....

Is the open jdk or oracle jdk? There are some differences in internal classes.

@andrewbaxter
Copy link
Author

@andrewbaxter
Copy link
Author

@andrewbaxter
Copy link
Author

It's possible there's a jvm command line override to access the package: http://stackoverflow.com/questions/41265266/how-to-solve-inaccessibleobjectexception-unable-to-make-member-accessible-m

@lessthanoptimal
Copy link
Owner

lessthanoptimal commented Mar 2, 2017

Still not ideal, but looking at your second comment I think there might be a workaround. Worst case scenario I'll have to create an implementation specific for JDK 9.

The reason these hacks are there is because BufferedImage is poorly designed from an efficiency perspective. As long as I can get access to the raw array and know the format it's encoded in this should be fast.

@lessthanoptimal
Copy link
Owner

Looked into this issue some more. Figured out how to still get access to the raw data. Unfortunate I have yet to figure out to get the data offset value. This means support for subimages will most likely be removed.

@lessthanoptimal
Copy link
Owner

I'm attempting to convince the developers of java 9 to change the api. Sounds like I missed the boat for the first release but maybe in a future update.

@lessthanoptimal
Copy link
Owner

Removed all references to internal sun raster classes. Should run in Java 9. Won't work with subimages in java 9

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