From 11cb02e8c8cdaef9c934f76092a5cd7bd70428f8ed82e1114de90fbb8640f584 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Fri, 1 Sep 2023 12:21:12 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/graphql-java?expand=0&rev=4 --- graphql-java.changes | 7 +++ graphql-java.spec | 10 +++- java8.patch | 109 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 java8.patch diff --git a/graphql-java.changes b/graphql-java.changes index 06a7f4b..84c6b19 100644 --- a/graphql-java.changes +++ b/graphql-java.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Sep 1 12:20:23 UTC 2023 - Fridrich Strba + +- Added patch: + * java8.patch + + keep Java 8 compatibility and build with -release 8 + ------------------------------------------------------------------- Fri Jul 14 13:48:23 UTC 2023 - Anton Shvetz diff --git a/graphql-java.spec b/graphql-java.spec index 9518525..10077b7 100644 --- a/graphql-java.spec +++ b/graphql-java.spec @@ -25,7 +25,8 @@ Group: Development/Libraries/Java URL: https://graphql-java.com/ Source0: https://github.com/%{name}/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: https://repo1.maven.org/maven2/com/%{name}/%{name}/%{version}/%{name}-%{version}.pom -BuildRequires: java-devel >= 11 +Patch0: java8.patch +BuildRequires: java-devel >= 1.8 BuildRequires: maven-local BuildRequires: mvn(com.google.guava:guava) BuildRequires: mvn(com.graphql-java:java-dataloader) @@ -49,6 +50,7 @@ API documentation for %{name}. %prep %setup -q +%patch0 -p1 cp %{SOURCE1} pom.xml %pom_add_dep com.google.guava:guava %pom_add_dep com.intellij:annotations @@ -80,7 +82,11 @@ cp %{SOURCE1} pom.xml mv src/main/antlr src/main/antlr4 %build -%{mvn_build} -f -- -Dmaven.compiler.{source,target}=11 +%{mvn_build} -f -- \ +%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0} + -Dmaven.compiler.release=8 \ +%endif + -Dmaven.compiler.{source,target}=8 %install %mvn_install diff --git a/java8.patch b/java8.patch new file mode 100644 index 0000000..bfd3f1c --- /dev/null +++ b/java8.patch @@ -0,0 +1,109 @@ +diff -urEbwB graphql-java-21.0.orig/src/main/java/graphql/normalized/ExecutableNormalizedField.java graphql-java-21.0/src/main/java/graphql/normalized/ExecutableNormalizedField.java +--- graphql-java-21.0.orig/src/main/java/graphql/normalized/ExecutableNormalizedField.java 2023-09-01 13:45:52.666395044 +0200 ++++ graphql-java-21.0/src/main/java/graphql/normalized/ExecutableNormalizedField.java 2023-09-01 14:07:53.265510599 +0200 +@@ -16,6 +16,7 @@ + import graphql.schema.GraphQLOutputType; + import graphql.schema.GraphQLSchema; + import graphql.schema.GraphQLUnionType; ++import graphql.schema.GraphQLUnmodifiedType; + import graphql.util.FpKit; + import graphql.util.MutableRef; + import org.jetbrains.annotations.NotNull; +@@ -187,7 +188,7 @@ + } + + public void forEachFieldDefinition(GraphQLSchema schema, Consumer consumer) { +- var fieldDefinition = resolveIntrospectionField(schema, objectTypeNames, fieldName); ++ GraphQLFieldDefinition fieldDefinition = resolveIntrospectionField(schema, objectTypeNames, fieldName); + if (fieldDefinition != null) { + consumer.accept(fieldDefinition); + return; +@@ -211,7 +212,7 @@ + * Internally there are cases where we know it is safe to use this, so this exists. + */ + private GraphQLFieldDefinition getOneFieldDefinition(GraphQLSchema schema) { +- var fieldDefinition = resolveIntrospectionField(schema, objectTypeNames, fieldName); ++ GraphQLFieldDefinition fieldDefinition = resolveIntrospectionField(schema, objectTypeNames, fieldName); + if (fieldDefinition != null) { + return fieldDefinition; + } +@@ -512,14 +513,14 @@ + private Set getInterfacesCommonToAllOutputTypes(GraphQLSchema schema) { + // Shortcut for performance + if (objectTypeNames.size() == 1) { +- var fieldDef = getOneFieldDefinition(schema); +- var outputType = unwrapAll(fieldDef.getType()); ++ GraphQLFieldDefinition fieldDef = getOneFieldDefinition(schema); ++ GraphQLUnmodifiedType outputType = unwrapAll(fieldDef.getType()); + + if (outputType instanceof GraphQLObjectType) { + return new LinkedHashSet<>((List) ((GraphQLObjectType) outputType).getInterfaces()); + } else if (outputType instanceof GraphQLInterfaceType) { +- var result = new LinkedHashSet<>((List) ((GraphQLInterfaceType) outputType).getInterfaces()); +- result.add(outputType); ++ Set result = new LinkedHashSet<>((List) ((GraphQLInterfaceType) outputType).getInterfaces()); ++ result.add((GraphQLInterfaceType) outputType); + return result; + } else { + return Collections.emptySet(); +@@ -528,7 +529,7 @@ + + MutableRef> commonInterfaces = new MutableRef<>(); + forEachFieldDefinition(schema, (fieldDef) -> { +- var outputType = unwrapAll(fieldDef.getType()); ++ GraphQLUnmodifiedType outputType = unwrapAll(fieldDef.getType()); + + List outputTypeInterfaces; + if (outputType instanceof GraphQLObjectType) { +diff -urEbwB graphql-java-21.0.orig/src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java graphql-java-21.0/src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java +--- graphql-java-21.0.orig/src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java 2023-09-01 13:45:52.673061757 +0200 ++++ graphql-java-21.0/src/main/java/graphql/schema/diffing/ana/EditOperationAnalyzer.java 2023-09-01 14:18:28.283228972 +0200 +@@ -1988,7 +1988,7 @@ + * + * @see #getTraversalOrder(List) + */ +- private static final List OPERATION_TRAVERSAL_ORDER = List.of( ++ private static final List OPERATION_TRAVERSAL_ORDER = java.util.Arrays.asList( + EditOperation.Operation.CHANGE_VERTEX, + EditOperation.Operation.INSERT_VERTEX, + EditOperation.Operation.DELETE_VERTEX, +@@ -2002,7 +2002,7 @@ + * + * @see #getTraversalOrder(List) + */ +- private static final List TYPE_TRAVERSAL_ORDER = List.of( ++ private static final List TYPE_TRAVERSAL_ORDER = java.util.Arrays.asList( + // These are all top level declarations + SchemaGraph.SCHEMA, + SchemaGraph.OBJECT, +diff -urEbwB graphql-java-21.0.orig/src/main/java/graphql/schema/fetching/LambdaFetchingSupport.java graphql-java-21.0/src/main/java/graphql/schema/fetching/LambdaFetchingSupport.java +--- graphql-java-21.0.orig/src/main/java/graphql/schema/fetching/LambdaFetchingSupport.java 2023-09-01 13:45:52.673061757 +0200 ++++ graphql-java-21.0/src/main/java/graphql/schema/fetching/LambdaFetchingSupport.java 2023-09-01 14:11:52.880498400 +0200 +@@ -209,11 +209,11 @@ + // + // This is a Java 9+ approach to method look up allowing private access + // +- try { +- return MethodHandles.privateLookupIn(targetClass, lookupMe); +- } catch (IllegalAccessException e) { ++// try { ++// return MethodHandles.privateLookupIn(targetClass, lookupMe); ++// } catch (IllegalAccessException e) { + return lookupMe; +- } ++// } + } + + } +diff -urEbwB graphql-java-21.0.orig/src/main/java/graphql/schema/SchemaTransformer.java graphql-java-21.0/src/main/java/graphql/schema/SchemaTransformer.java +--- graphql-java-21.0.orig/src/main/java/graphql/schema/SchemaTransformer.java 2023-09-01 13:45:52.669728400 +0200 ++++ graphql-java-21.0/src/main/java/graphql/schema/SchemaTransformer.java 2023-09-01 13:53:09.762743168 +0200 +@@ -195,7 +195,7 @@ + Map> reverseDependencies = new LinkedHashMap<>(); + Map> typeRefReverseDependencies = new LinkedHashMap<>(); + +- TraverserVisitor nodeTraverserVisitor = new TraverserVisitor<>() { ++ TraverserVisitor nodeTraverserVisitor = new TraverserVisitor() { + @Override + public TraversalControl enter(TraverserContext context) { + GraphQLSchemaElement currentSchemaElement = context.thisNode();