Skip to content

Commit

Permalink
Fix ImcompatibleClassChangeError.
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt committed Dec 17, 2023
1 parent 044438d commit fcf0d4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions jfx/src/main/java/net/burningtnt/webp/jfx/WEBPImageLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static ImageDescriptor getImageDescriptor() {
* @param extensions A constant which always be {@code "webp"}.
* @param signatures A constant which always {@code new ImageFormatDescription.Signature[]{new ImageFormatDescription.Signature((byte) 'R', (byte) 'I', (byte) 'F', (byte) 'F')}}.
* @return The {@code ImageDescriptor} with WEBP signature.
* @throws NoSuchMethodError If the adapter doesn't match the current JavaFX version.
* @throws IncompatibleClassChangeError If the adapter doesn't match the current JavaFX version.
*/
@JavaFXAdapter(state = JavaFXAdapter.State.INVLUDED_BEFORE, commit = "72deb62df704aa1baa355ad2e1428524cb978d6c")
@BytecodeImpl({
Expand All @@ -63,7 +63,7 @@ public static ImageDescriptor getImageDescriptor() {
"MAXS 5 2"
})
@SuppressWarnings("unused")
private static ImageDescriptor constructImageDescriptor1(String[] extensions, ImageFormatDescription.Signature[] signatures) throws NoSuchMethodError {
private static ImageDescriptor constructImageDescriptor1(String[] extensions, ImageFormatDescription.Signature[] signatures) throws IncompatibleClassChangeError {
throw new BytecodeImplError();
}

Expand All @@ -76,7 +76,7 @@ private static ImageDescriptor constructImageDescriptor1(String[] extensions, Im
* @param signatures A constant which always {@code new ImageFormatDescription.Signature[]{new ImageFormatDescription.Signature((byte) 'R', (byte) 'I', (byte) 'F', (byte) 'F')}, mimeSubtypes}.
* @param mimeSubtypes A constant which always be {@code "webp"}.
* @return The {@code ImageDescriptor} with WEBP signature.
* @throws NoSuchMethodError If the adapter doesn't match the current JavaFX version.
* @throws IncompatibleClassChangeError If the adapter doesn't match the current JavaFX version.
*/
@JavaFXAdapter(state = JavaFXAdapter.State.INVLUDED_AFTER, commit = "f326e78ffdfcbbc9085bc50a38e0b4454b757157")
@BytecodeImpl({
Expand All @@ -96,7 +96,7 @@ private static ImageDescriptor constructImageDescriptor1(String[] extensions, Im
"MAXS 6 3"
})
@SuppressWarnings("unused")
private static ImageDescriptor constructImageDescriptor2(String[] extensions, ImageFormatDescription.Signature[] signatures, String[] mimeSubtypes) throws NoSuchMethodError {
private static ImageDescriptor constructImageDescriptor2(String[] extensions, ImageFormatDescription.Signature[] signatures, String[] mimeSubtypes) throws IncompatibleClassChangeError {
throw new BytecodeImplError();
}

Expand All @@ -122,10 +122,10 @@ private static ImageDescriptor initImageDescriptor() throws UnsupportedOperation
final ImageFormatDescription.Signature[] signatures = {new ImageFormatDescription.Signature((byte) 'R', (byte) 'I', (byte) 'F', (byte) 'F')};
try {
return constructImageDescriptor1(extensions, signatures);
} catch (NoSuchMethodError e) {
} catch (IncompatibleClassChangeError e) {
try {
return constructImageDescriptor2(extensions, signatures, extensions);
} catch (NoSuchMethodError e2) {
} catch (IncompatibleClassChangeError e2) {
e2.addSuppressed(e);
throw new UnsupportedOperationException("Cannot construct a ImageDescriptor.", e2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public ImageLoader createImageLoader(InputStream input) {
/**
* Add the instance of {@code WEBPImageLoaderFactory} into JavaFX <a href="https://github.com/openjdk/jfx/blob/171e484ca63bdfd50599417482eb704f71f10107/modules/javafx.graphics/src/main/java/com/sun/javafx/iio/ImageStorage.java#L199">171e484ca63bdfd50599417482eb704f71f10107</a>.
* Same as {@code ImageStorage.addImageLoaderFactory(instance)}.
* @throws NoSuchMethodError If the adapter doesn't match the current JavaFX version.
* @throws IncompatibleClassChangeError If the adapter doesn't match the current JavaFX version.
*/
@JavaFXAdapter(state = JavaFXAdapter.State.INVLUDED_BEFORE, commit = "171e484ca63bdfd50599417482eb704f71f10107")
@BytecodeImpl({
Expand All @@ -58,14 +58,14 @@ public ImageLoader createImageLoader(InputStream input) {
"MAXS 1 0"
})
@SuppressWarnings("unused")
private static void addImageLoaderFactory1() throws NoSuchMethodError {
private static void addImageLoaderFactory1() throws IncompatibleClassChangeError {
throw new BytecodeImplError();
}

/**
* Add the instance of {@code WEBPImageLoaderFactory} into JavaFX <a href="https://github.com/openjdk/jfx/blob/f326e78ffdfcbbc9085bc50a38e0b4454b757157/modules/javafx.graphics/src/main/java/com/sun/javafx/iio/ImageStorage.java#L215">f326e78ffdfcbbc9085bc50a38e0b4454b757157</a>.
* Same as {@code ImageStorage.getInstance().addImageLoaderFactory(instance)}.
* @throws NoSuchMethodError If the adapter doesn't match the current JavaFX version.
* @throws IncompatibleClassChangeError If the adapter doesn't match the current JavaFX version.
*/
@JavaFXAdapter(state = JavaFXAdapter.State.INVLUDED_AFTER, commit = "f326e78ffdfcbbc9085bc50a38e0b4454b757157")
@BytecodeImpl({
Expand All @@ -78,7 +78,7 @@ private static void addImageLoaderFactory1() throws NoSuchMethodError {
"MAXS 2 0"
})
@SuppressWarnings("unused")
private static void addImageLoaderFactory2() throws NoSuchMethodError {
private static void addImageLoaderFactory2() throws IncompatibleClassChangeError {
throw new BytecodeImplError();
}

Expand All @@ -101,7 +101,7 @@ private static void addImageLoaderFactory2() throws NoSuchMethodError {
public static void setupListener() throws UnsupportedOperationException {
try {
addImageLoaderFactory1();
} catch (NoSuchMethodError e) {
} catch (IncompatibleClassChangeError e) {
try {
addImageLoaderFactory2();
} catch (Throwable e2) {
Expand Down

0 comments on commit fcf0d4d

Please sign in to comment.