Skip to content

Commit

Permalink
Merge branch 'master' into jigsaw_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Auties00 authored Jul 18, 2022
2 parents b962a40 + a359500 commit 7219e1b
Show file tree
Hide file tree
Showing 80 changed files with 1,374 additions and 583 deletions.
36 changes: 0 additions & 36 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

83 changes: 83 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: Provide a general description of the bug, in plain text. Use the dedicated fields below for code snippets.
placeholder: Description of the bug
validations:
required: true
- type: textarea
id: java-input
attributes:
label: Source code you are trying to analyze/transform
description: Provide a minimal example of source code you are trying to analyze/transform that causes the bug to appear. This will be automatically formatted, so no need for backticks.
placeholder: System.out.println("Hello, world!");
render: Java
validations:
required: false
- type: textarea
id: spoon-code
attributes:
label: Source code for your Spoon processing
description: Provide your processing code that uses Spoon and causes the bug to appear. This will be automatically formatted, so no need for backticks.
placeholder: Launcher launcher = new Launcher();
render: Java
validations:
required: false
- type: textarea
id: output
attributes:
label: Actual output
description: The output that spoon provides, or a stacktrace if it crashes. This will be automatically formatted, so no need for backticks.
placeholder: System.out.println("Hello, world!");
render: Java
validations:
required: false
- type: textarea
id: expected-output
attributes:
label: Expected output
description: If you know what kind of output you expect to get, please provide it here. This will be automatically formatted, so no need for backticks.
placeholder: System.out.println("Hello, world!");
render: Java
validations:
required: false
- type: textarea
id: version
attributes:
label: Spoon Version
description: What version of Spoon are you using? Please note that we only actively support the latest major release. If you are using an older major version, your issue may be closed as non-actionable.
placeholder: X.Y.Z
validations:
required: true
- type: dropdown
id: jvm-version
attributes:
label: JVM Version
description: Which JVM version are you running Spoon with? Note that Spoon is built for Java 11+, and we cannot maintain support for older versions.
options:
- "11"
- "12"
- "13"
- "14"
- "15"
- "16"
- "17"
- "18"
validations:
required: true
- type: textarea
id: os
attributes:
label: What operating system are you using?
validations:
required: true
22 changes: 11 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Disable Git's autocrlf
run: git config --global core.autocrlf false
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142 # tag=v3.3.0
- uses: actions/setup-java@2c7a4878f5d120bd643426d54ae1209b29cc01a3 # tag=v3.4.1
with:
java-version: ${{ matrix.java }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
Expand All @@ -48,7 +48,7 @@ jobs:
run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Use Maven dependency cache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # tag=v3.0.4
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129 # tag=v3.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/pom.xml') }}
Expand All @@ -75,7 +75,7 @@ jobs:
name: Test with coverage
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142 # tag=v3.3.0
- uses: actions/setup-java@2c7a4878f5d120bd643426d54ae1209b29cc01a3 # tag=v3.4.1
with:
java-version: 17
distribution: ${{ env.JAVA_DISTRIBUTION }}
Expand All @@ -85,7 +85,7 @@ jobs:
run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Use Maven dependency cache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # tag=v3.0.4
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129 # tag=v3.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/pom.xml') }}
Expand All @@ -111,11 +111,11 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
with:
fetch-depth: 0
- uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142 # tag=v3.3.0
- uses: actions/setup-java@2c7a4878f5d120bd643426d54ae1209b29cc01a3 # tag=v3.4.1
with:
java-version: 17
distribution: ${{ env.JAVA_DISTRIBUTION }}
- uses: actions/setup-python@d09bd5e6005b175076f227b13d9730d56e9dcfcb # tag=v4.0.0
- uses: actions/setup-python@c4e89fac7e8767b327bbad6cb4d859eda999cf08 # tag=v4.1.0
with:
python-version: 3.6

Expand All @@ -124,7 +124,7 @@ jobs:
run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Use Maven dependency cache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # tag=v3.0.4
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129 # tag=v3.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/pom.xml') }}
Expand All @@ -148,14 +148,14 @@ jobs:
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
with:
path: pull_request
- uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142 # tag=v3.3.0
- uses: actions/setup-java@2c7a4878f5d120bd643426d54ae1209b29cc01a3 # tag=v3.4.1
with:
java-version: 17
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: git reset
run: cd pull_request && git fetch && git reset --soft origin/master
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@b06a3f2289e63df0b6746cfd80f5af9fb6a6c65a # tag=v5.1.0
uses: JetBrains/qodana-action@102d021fe8a24d8af48a38a35f96b8ba100baa20 # tag=v2022.1.1
with:
linter: ${{ env.QODANA_LINTER }}
project-dir: "${{ github.workspace }}/pull_request"
Expand All @@ -165,7 +165,7 @@ jobs:
fail-threshold: 0
use-annotations: false
use-caches: false # we disable cache for consistent results
- uses: github/codeql-action/upload-sarif@27ea8f8fe5977c00f5b37e076ab846c5bd783b96 # tag=v2
- uses: github/codeql-action/upload-sarif@3f62b754e23e0dd60f91b744033e1dc1654c0ec6 # tag=v2
if: always()
with:
sarif_file: "${{ github.workspace }}/result/qodana.sarif.json"
Expand All @@ -179,7 +179,7 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
with:
fetch-depth: 0
- uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142 # tag=v3.3.0
- uses: actions/setup-java@2c7a4878f5d120bd643426d54ae1209b29cc01a3 # tag=v3.4.1
with:
java-version: 17
distribution: ${{ env.JAVA_DISTRIBUTION }}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ If you need professional support on Spoon (development, training, extension), yo

## Getting started in 2 seconds

> **Java version:** Spoon version 10 and up requires Java 11 or later. Spoon 9.1.0 is the final Spoon release compatible with Java 8.
> **Java version:** Spoon version 10 and up requires Java 11 or later. Spoon 9.1.0 is the final Spoon release compatible
> with Java 8, and we do not plan to backport any bug fixes or features to Spoon 9. Note that Spoon can of course still
> consume source code for older versions of Java, but it needs JDK 11+ to run.
Get latest stable version with Maven, see <https://search.maven.org/artifact/fr.inria.gforge.spoon/spoon-core>

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.29.0</version>
<version>3.30.0</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.platform</groupId>
Expand Down Expand Up @@ -227,7 +227,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
<configuration>
<archive>
<manifest>
Expand Down
2 changes: 1 addition & 1 deletion spoon-decompiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
<configuration>
<archive>
<manifest>
Expand Down
2 changes: 1 addition & 1 deletion spoon-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>3.5.1</version>
<version>3.5.2</version>
</dependency>
</dependencies>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import spoon.reflect.cu.SourcePositionHolder;
import spoon.reflect.declaration.CtClass;
import spoon.reflect.declaration.CtElement;
import spoon.reflect.declaration.CtSealable;
import spoon.reflect.declaration.CtType;
import spoon.reflect.path.CtPath;
import spoon.reflect.visitor.CtVisitable;
Expand Down Expand Up @@ -232,7 +233,7 @@ void testSaveText(final FxRobot robot, @TempDir final Path tempDir) throws IOExc
@Test
void getDirectSpoonInterfacesOfClass() {
final List<Class<?>> inter = spoonCodeInstrument.getDirectSpoonInterfaces(CtClass.class).collect(Collectors.toList());
assertThat(inter).containsExactlyInAnyOrder(CtType.class, CtStatement.class);
assertThat(inter).containsExactlyInAnyOrder(CtType.class, CtStatement.class, CtSealable.class);
}

@Test
Expand Down
1 change: 1 addition & 0 deletions src/main/java/spoon/metamodel/Metamodel.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public static Set<CtType<?>> getAllMetamodelInterfaces() {
result.add(factory.Type().get(spoon.reflect.declaration.CtNamedElement.class));
result.add(factory.Type().get(spoon.reflect.declaration.CtPackage.class));
result.add(factory.Type().get(spoon.reflect.declaration.CtParameter.class));
result.add(factory.Type().get(spoon.reflect.declaration.CtSealable.class));
result.add(factory.Type().get(spoon.reflect.declaration.CtShadowable.class));
result.add(factory.Type().get(spoon.reflect.declaration.CtType.class));
result.add(factory.Type().get(spoon.reflect.declaration.CtTypeInformation.class));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/spoon/reflect/declaration/CtClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* </pre>
* @author Renaud Pawlak
*/
public interface CtClass<T> extends CtType<T>, CtStatement {
public interface CtClass<T> extends CtType<T>, CtStatement, CtSealable {
/**
* Returns the anonymous blocks of this class.
* Derived from {@link #getTypeMembers()}
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/spoon/reflect/declaration/CtEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import spoon.reflect.reference.CtTypeReference;
import spoon.reflect.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;
import spoon.support.DerivedProperty;
import spoon.support.UnsettableProperty;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import static spoon.reflect.path.CtRole.VALUE;

Expand Down Expand Up @@ -80,4 +83,20 @@ public interface CtEnum<T extends Enum<?>> extends CtClass<T> {
@Override
@UnsettableProperty
<C extends CtType<T>> C setSuperclass(CtTypeReference<?> superClass);

@Override
@DerivedProperty
Set<CtTypeReference<?>> getPermittedTypes();

@Override
@UnsettableProperty
CtEnum<T> setPermittedTypes(Collection<CtTypeReference<?>> permittedTypes);

@Override
@UnsettableProperty
CtEnum<T> addPermittedType(CtTypeReference<?> type);

@Override
@UnsettableProperty
CtEnum<T> removePermittedType(CtTypeReference<?> type);
}
2 changes: 1 addition & 1 deletion src/main/java/spoon/reflect/declaration/CtInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* }
* </pre>
*/
public interface CtInterface<T> extends CtType<T>, CtStatement {
public interface CtInterface<T> extends CtType<T>, CtStatement, CtSealable {
@Override
CtInterface<T> clone();

Expand Down
16 changes: 16 additions & 0 deletions src/main/java/spoon/reflect/declaration/CtRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package spoon.reflect.declaration;

import java.util.Collection;
import java.util.Set;
import spoon.reflect.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;
Expand Down Expand Up @@ -40,4 +41,19 @@ public interface CtRecord extends CtClass<Object> {
@Override
@UnsettableProperty
<C extends CtType<Object>> C setSuperclass(CtTypeReference<?> superClass);

@Override
Set<CtTypeReference<?>> getPermittedTypes();

@Override
@UnsettableProperty
CtRecord setPermittedTypes(Collection<CtTypeReference<?>> permittedTypes);

@Override
@UnsettableProperty
CtRecord addPermittedType(CtTypeReference<?> type);

@Override
@UnsettableProperty
CtRecord removePermittedType(CtTypeReference<?> type);
}
Loading

0 comments on commit 7219e1b

Please sign in to comment.