Skip to content

Commit

Permalink
Merge branch 'variant-Jdk-17' into 'master'
Browse files Browse the repository at this point in the history
openjdk 17 Debian 11 bullseye

See merge request exedio/copebuilder!11
  • Loading branch information
mheinzerling committed Sep 17, 2024
2 parents bfee2cc + 895a23a commit 30a48dd
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 31 deletions.
1 change: 1 addition & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import groovy.transform.stc.ClosureParams
import groovy.transform.stc.SimpleType

@Field
String jdk = 'openjdk-11'
String jdk = 'openjdk-17'
@Field
String idea = '2023.2'
@Field
Expand Down
2 changes: 1 addition & 1 deletion conf/idea/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ curl \
EOF


FROM debian:buster-20220418
FROM debian:bullseye-20220418

ARG JDK
RUN <<EOF
Expand Down
2 changes: 1 addition & 1 deletion conf/main/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:buster-20220418
FROM debian:bullseye-20220418

ARG JDK
RUN <<EOF
Expand Down
2 changes: 1 addition & 1 deletion copebuilder.iml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<src_folder value="file://$MODULE_DIR$/testsrc" expected_position="2" />
</src_description>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_17">
<output url="file://$MODULE_DIR$/.eclipse-output" />
<exclude-output />
<content url="file://$MODULE_DIR$">
Expand Down
1 change: 1 addition & 0 deletions exedio-cope-builder-log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ omit bug fixes.
The items are sorted inversely, i.e. latest items are on top

--------------------------------------------------------------------------
* JDK 17 required
* add @SuppressWarnings({"ClassEscapesDefinedScope", "RedundantSuppression"}) to generated builder
* ant 1.9.7 required
* JDK 11 required
Expand Down
2 changes: 1 addition & 1 deletion src/com/exedio/cope/builder/ItemBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public I build()
}

@SuppressWarnings("unchecked")
private <T> Condition equalCondition(final FunctionField<?> key, final SetValue<?> value)
private static <T> Condition equalCondition(final FunctionField<?> key, final SetValue<?> value)
{
//noinspection RedundantCast
return ((FunctionField<T>) key).equal(((SetValue<T>) value).value);
Expand Down
5 changes: 2 additions & 3 deletions src/com/exedio/cope/builder/generator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ static void run(final Params params) throws HumanReadableException, IOException
{
for(final Feature feature : type.getDeclaredFeatures())
{
if(!(feature instanceof CompositeField<?>))
if(!(feature instanceof final CompositeField<?> field))
continue;

final CompositeField<?> field = (CompositeField<?>) feature;

final Class<? extends Composite> clazz = field.getValueClass();
if(!params.matchesPackagePrefixes(clazz))
{
Expand All @@ -82,6 +80,7 @@ static void run(final Params params) throws HumanReadableException, IOException
private static void printSummary(final Params params, final Model model, final ArrayList<Class<?>> skippedPackagePrefix,
final HashMap<File, ArrayList<Class<?>>> skippedTargetDirectoryDoesNotExist, final int generatedBuilders)
{
//noinspection EnhancedSwitchMigration
switch(skippedPackagePrefix.size())
{
case 0: // nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static File getFileContaining(final URI uri)
if(scheme == null)
throw new IllegalArgumentException("scheme null in " + uri);

//noinspection EnhancedSwitchMigration
switch(scheme)
{
case "file":
Expand Down
2 changes: 1 addition & 1 deletion src/com/exedio/cope/builder/generator/Params.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void addPackagePrefix(final String packagePrefix)
"packagePrefix \"" + packagePrefix + "\" must not end with dot.");

packagePrefixesMatch.add(packagePrefix + '.');
if(packagePrefixesDisplay.length() > 0)
if(!packagePrefixesDisplay.isEmpty())
packagePrefixesDisplay.append(',');
packagePrefixesDisplay.append(packagePrefix);
}
Expand Down
12 changes: 4 additions & 8 deletions src/com/exedio/cope/builder/generator/Writer.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,16 @@ else if(feature instanceof PriceField)
"final int store",
"com.exedio.cope.pattern.Price.storeOf(store)");
}
else if(feature instanceof MoneyField)
else if(feature instanceof final MoneyField<?> field)
{
final MoneyField<?> field = (MoneyField<?>) feature;
final String currencyClass = TypeUtil.getCanonicalName(field.getCurrencyClass());
writeRedirectSetter(writer, featureIdentifier, "final double value," + "final " + currencyClass + " currency",
"com.exedio.cope.pattern.Money.valueOf(value,currency)");
writeRedirectSetter(writer, featureIdentifier, "final int store," + "final " + currencyClass + " currency",
"com.exedio.cope.pattern.Money.storeOf(store,currency)");
}
else if(feature instanceof ItemField)
else if(feature instanceof final ItemField<?> field)
{
final ItemField<?> field = (ItemField<?>) feature;
final Class<? extends Item> elementClass = field.getValueClass();
Type<?> elementType = null;
try
Expand Down Expand Up @@ -200,9 +198,8 @@ else if(feature instanceof ItemField)
}
}
}
else if(feature instanceof CompositeField)
else if(feature instanceof final CompositeField<?> field)
{
final CompositeField<?> field = (CompositeField<?>) feature;
final CompositeType myType = new CompositeType(field);
if(generated.contains(myType))
{
Expand All @@ -223,9 +220,8 @@ else if(feature instanceof CompositeField)
System.out.println("Skip external composite lambda builder setter:" + field + " " + myType.getJavaClass());
}
}
else if(feature instanceof EnumMapField)
else if(feature instanceof final EnumMapField<?, ?> enumMapField)
{
final EnumMapField<?, ?> enumMapField = (EnumMapField<?, ?>) feature;
final Class<? extends Enum<?>> keyClass = enumMapField.getKeyClass();
final String enumKeyType = TypeUtil.getCanonicalName(enumMapField.getKeyClass());
final String enumValueType = TypeUtil.getCanonicalName(enumMapField.getValueClass());
Expand Down
18 changes: 6 additions & 12 deletions src/com/exedio/cope/builder/generator/type/TypeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,24 @@ private static String getCanonicalName(@Nonnull final ParameterizedType type)
@Nullable
public static String valueType(@Nonnull final Feature feature)
{
if(feature instanceof Settable<?>)
if(feature instanceof final Settable<?> field)
{
final Settable<?> field = (Settable<?>) feature;
final Type valueClass = field.getInitialType();
final Type primitiveClass = (valueClass instanceof Class && field.isMandatory())
? PrimitiveUtil.toPrimitive((Class<?>) valueClass)
: valueClass;
return getCanonicalName((primitiveClass != null) ? primitiveClass : Objects.requireNonNull(valueClass));
}
else if(feature instanceof SetField<?>)
else if(feature instanceof final SetField<?> field)
{
final SetField<?> field = (SetField<?>) feature;
return Set.class.getName() + '<' + getCanonicalName(field.getElement().getValueClass()) + '>';
}
else if(feature instanceof ListField<?>)
else if(feature instanceof final ListField<?> field)
{
final ListField<?> field = (ListField<?>) feature;
return List.class.getName() + '<' + getCanonicalName(field.getElement().getValueClass()) + '>';
}
else if(feature instanceof MapField<?, ?>)
else if(feature instanceof final MapField<?, ?> field)
{
final MapField<?, ?> field = (MapField<?, ?>) feature;
return Map.class.getName() + '<' + getCanonicalName(field.getKey().getValueClass()) + ',' + getCanonicalName(field.getValue().getValueClass())
+ '>';
}
Expand All @@ -97,9 +93,8 @@ public static String fieldType(@Nonnull final Feature feature)
{
if(feature instanceof Settable)
{
if(feature instanceof EnumMapField)
if(feature instanceof final EnumMapField<?, ?> field)
{
final EnumMapField<?, ?> field = (EnumMapField<?, ?>) feature;
return EnumMapField.class.getCanonicalName() + '<' + getCanonicalName(field.getKeyClass()) + ',' +
getCanonicalName(field.getValueClass()) + '>';
}
Expand All @@ -113,9 +108,8 @@ else if(feature instanceof ListField)
{
return ListField.class.getName() + '<' + getCanonicalName(((ListField<?>) feature).getElement().getValueClass()) + '>';
}
else if(feature instanceof MapField)
else if(feature instanceof final MapField<?, ?> field)
{
final MapField<?, ?> field = (MapField<?, ?>) feature;
return MapField.class.getName() + '<' + getCanonicalName(field.getKey().getValueClass()) + ',' +
getCanonicalName(field.getValue().getValueClass()) + '>';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public void fallback()
}

@Test
@SuppressWarnings("MisorderedAssertEqualsArguments") // OK: bug in idea
public void getOrBuild()
{
assertEquals(asList(), CompositeItem.TYPE.search());
Expand Down

0 comments on commit 30a48dd

Please sign in to comment.