Skip to content

Commit

Permalink
multi release jar removed
Browse files Browse the repository at this point in the history
Signed-off-by: David Kral <[email protected]>
  • Loading branch information
Verdent committed May 22, 2024
1 parent 0102bed commit 59ec118
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 109 deletions.
29 changes: 7 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<executions>
<execution>
<id>default-testCompile</id>
<configuration>
<release>16</release>
<release>17</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/test/java</compileSourceRoot>
<compileSourceRoot>${project.basedir}/src/test/java16</compileSourceRoot>
Expand Down Expand Up @@ -394,28 +393,15 @@
<goal>compile</goal>
</goals>
<configuration>
<release>11</release>
<source>11</source>
<target>11</target>
<release>17</release>
<source>17</source>
<target>17</target>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<configuration>
<release>11</release>
</configuration>
</execution>
<execution>
<id>multi-release-compile-16</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>16</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java16</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
<release>17</release>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -471,7 +457,7 @@
<additionalJOption>--add-modules</additionalJOption>
<additionalJOption>jakarta.json.bind,jakarta.json</additionalJOption>
</additionalJOptions>
<source>11</source>
<source>17</source>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -591,7 +577,7 @@
<configuration>
<rules>
<requireJavaVersion>
<version>[11,)</version>
<version>[17,)</version>
</requireJavaVersion>
<requireMavenVersion>
<version>[3.3.9,)</version>
Expand Down Expand Up @@ -714,7 +700,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs-maven-plugin.version}</version>
</plugin>
</plugins>
</reporting>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -22,6 +22,8 @@

import org.eclipse.yasson.internal.model.JsonbCreator;
import org.eclipse.yasson.internal.model.Property;
import org.eclipse.yasson.internal.properties.MessageKeys;
import org.eclipse.yasson.internal.properties.Messages;

/**
* Search for instance creator from other sources.
Expand All @@ -34,25 +36,38 @@ private ClassMultiReleaseExtension() {
}

static boolean shouldTransformToPropertyName(Method method) {
return true;
return !method.getDeclaringClass().isRecord();
}

static boolean isSpecialAccessorMethod(Method method, Map<String, Property> classProperties) {
return false;
return isRecord(method.getDeclaringClass())
&& method.getParameterCount() == 0
&& !void.class.equals(method.getReturnType())
&& classProperties.containsKey(method.getName());
}

static JsonbCreator findCreator(Class<?> clazz,
Constructor<?>[] declaredConstructors,
AnnotationIntrospector introspector,
PropertyNamingStrategy propertyNamingStrategy) {
if (clazz.isRecord()) {
if (declaredConstructors.length == 1) {
return introspector.createJsonbCreator(declaredConstructors[0], null, clazz, propertyNamingStrategy);
}
}
return null;
}

public static boolean isRecord(Class<?> clazz) {
return false;
return clazz.isRecord();
}

public static Optional<JsonbException> exceptionToThrow(Class<?> clazz) {
if (clazz.isRecord()) {
if (clazz.getDeclaredConstructors().length > 1) {
return Optional.of(new JsonbException(Messages.getMessage(MessageKeys.RECORD_MULTIPLE_CONSTRUCTORS, clazz)));
}
}
return Optional.empty();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down

0 comments on commit 59ec118

Please sign in to comment.