Skip to content

Commit

Permalink
updated strictfp tests
Browse files Browse the repository at this point in the history
Also updated the byte code of Methods.class inside the testData.jar: it
is now compiled with Java 17
  • Loading branch information
LorenzoBettini committed Oct 29, 2024
1 parent c2e1312 commit ce2c171
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
import org.eclipse.xtext.common.types.testSetups.Bug427098;
import org.eclipse.xtext.common.types.testSetups.Bug428340;
import org.eclipse.xtext.common.types.testSetups.Bug456328;
import org.eclipse.xtext.common.types.testSetups.CallableThrowsExceptions;
import org.eclipse.xtext.common.types.testSetups.Bug470767;
import org.eclipse.xtext.common.types.testSetups.CallableThrowsExceptions;
import org.eclipse.xtext.common.types.testSetups.ClassContainingEnum;
import org.eclipse.xtext.common.types.testSetups.ClassWithVarArgs;
import org.eclipse.xtext.common.types.testSetups.DeprecatedMembers;
Expand All @@ -104,15 +104,13 @@
import org.eclipse.xtext.common.types.testSetups.StaticNestedTypes;
import org.eclipse.xtext.common.types.testSetups.TestAnnotation;
import org.eclipse.xtext.common.types.testSetups.TestAnnotation.Annotated;
import org.eclipse.xtext.util.JavaRuntimeVersion;
import org.eclipse.xtext.common.types.testSetups.TestAnnotationWithDefaults;
import org.eclipse.xtext.common.types.testSetups.TestAnnotationWithStringDefault;
import org.eclipse.xtext.common.types.testSetups.TestConstants;
import org.eclipse.xtext.common.types.testSetups.TestEnum;
import org.eclipse.xtext.common.types.testSetups.TypeWithInnerAnnotation;
import org.eclipse.xtext.common.types.testSetups.TypeWithInnerEnum;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -2003,26 +2001,6 @@ public void testStrictFpType() {
// strictfp on class declarations is not reflected
}

@Test
public void testMethods_publicStrictFpMethod_01() {
// strictfp has no effect since Java 17 https://openjdk.org/jeps/306
// and it doesn't seem to be present at runtime in 17+
// see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=545510#c6
// for sure, it fails with Java 21
Assume.assumeFalse("Ignored on Java 21 and later", JavaRuntimeVersion.isJava21OrLater());
String typeName = Methods.class.getName();
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
JvmOperation method = getMethodFromType(type, Methods.class, "publicStrictFpMethod()");
assertSame(type, method.getDeclaringType());
assertFalse(method.isAbstract());
assertFalse(method.isFinal());
assertFalse(method.isStatic());
assertFalse(method.isSynchronized());
assertTrue(method.isStrictFloatingPoint()); // it fails with Java 21
JvmType methodType = method.getReturnType().getType();
assertEquals("void", methodType.getIdentifier());
}

@Test
public void publicNativeMethod() {
String typeName = Methods.class.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@
import org.eclipse.xtext.common.types.testSetups.StaticNestedTypes;
import org.eclipse.xtext.common.types.testSetups.TestAnnotation;
import org.eclipse.xtext.common.types.testSetups.TestAnnotation.Annotated;
import org.eclipse.xtext.util.JavaRuntimeVersion;
import org.eclipse.xtext.common.types.testSetups.TestAnnotationWithDefaults;
import org.eclipse.xtext.common.types.testSetups.TestAnnotationWithStringDefault;
import org.eclipse.xtext.common.types.testSetups.TestConstants;
import org.eclipse.xtext.common.types.testSetups.TestEnum;
import org.eclipse.xtext.common.types.testSetups.TypeWithInnerAnnotation;
import org.eclipse.xtext.common.types.testSetups.TypeWithInnerEnum;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -2026,8 +2024,6 @@ public void testMethods_publicStrictFpMethod_01() {
// strictfp has no effect since Java 17 https://openjdk.org/jeps/306
// and it doesn't seem to be present at runtime in 17+
// see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=545510#c6
// for sure, it fails with Java 21
Assume.assumeFalse("Ignored on Java 21 and later", JavaRuntimeVersion.isJava21OrLater());
String typeName = Methods.class.getName();
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
JvmOperation method = getMethodFromType(type, Methods.class, "publicStrictFpMethod()");
Expand All @@ -2036,7 +2032,7 @@ public void testMethods_publicStrictFpMethod_01() {
assertFalse(method.isFinal());
assertFalse(method.isStatic());
assertFalse(method.isSynchronized());
assertTrue(method.isStrictFloatingPoint()); // it fails with Java 21
assertFalse(method.isStrictFloatingPoint()); // not available anymore since Java 17
JvmType methodType = method.getReturnType().getType();
assertEquals("void", methodType.getIdentifier());
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
*******************************************************************************/
package org.eclipse.xtext.common.types.access.impl;

import static com.google.common.collect.Iterables.*;
import static com.google.common.collect.Iterables.contains;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.size;
import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Iterables.tryFind;

import java.io.Serializable;
import java.lang.annotation.Annotation;
Expand Down Expand Up @@ -85,8 +89,8 @@
import org.eclipse.xtext.common.types.testSetups.Bug427098;
import org.eclipse.xtext.common.types.testSetups.Bug428340;
import org.eclipse.xtext.common.types.testSetups.Bug456328;
import org.eclipse.xtext.common.types.testSetups.CallableThrowsExceptions;
import org.eclipse.xtext.common.types.testSetups.Bug470767;
import org.eclipse.xtext.common.types.testSetups.CallableThrowsExceptions;
import org.eclipse.xtext.common.types.testSetups.ClassContainingEnum;
import org.eclipse.xtext.common.types.testSetups.ClassWithVarArgs;
import org.eclipse.xtext.common.types.testSetups.DeprecatedMembers;
Expand All @@ -111,9 +115,7 @@
import org.eclipse.xtext.common.types.testSetups.TypeWithInnerAnnotation;
import org.eclipse.xtext.common.types.testSetups.TypeWithInnerEnum;
import org.eclipse.xtext.java.tests.MyStubbedList;
import org.eclipse.xtext.util.JavaRuntimeVersion;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -2026,8 +2028,6 @@ public void testMethods_publicStrictFpMethod_01() {
// strictfp has no effect since Java 17 https://openjdk.org/jeps/306
// and it doesn't seem to be present at runtime in 17+
// see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=545510#c6
// for sure, it fails with Java 21
Assume.assumeFalse("Ignored on Java 21 and later", JavaRuntimeVersion.isJava21OrLater());
String typeName = Methods.class.getName();
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
JvmOperation method = getMethodFromType(type, Methods.class, "publicStrictFpMethod()");
Expand All @@ -2036,7 +2036,7 @@ public void testMethods_publicStrictFpMethod_01() {
assertFalse(method.isFinal());
assertFalse(method.isStatic());
assertFalse(method.isSynchronized());
assertTrue(method.isStrictFloatingPoint()); // it fails with Java 21
assertFalse(method.isStrictFloatingPoint()); // not available anymore since Java 17
assertFalse(method.isNative());
assertEquals(JvmVisibility.PUBLIC, method.getVisibility());
JvmType methodType = method.getReturnType().getType();
Expand Down

0 comments on commit ce2c171

Please sign in to comment.