Skip to content

Commit

Permalink
Add sealed classes
Browse files Browse the repository at this point in the history
  • Loading branch information
leibnitz27 committed Aug 9, 2021
1 parent 2ddcc75 commit b8412d2
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<path.source_10>src</path.source_10>
<path.source_12>src</path.source_12>
<path.source_14>src</path.source_14>
<path.source_16>src</path.source_16>
<path.target>output/java_6</path.target>
<javac.arguments></javac.arguments>
</properties>
Expand Down Expand Up @@ -78,6 +79,7 @@
<path.source_10>src</path.source_10>
<path.source_12>src</path.source_12>
<path.source_14>src</path.source_14>
<path.source_16>src</path.source_16>
<path.target>output/java_8</path.target>
<javac.arguments></javac.arguments>
</properties>
Expand Down Expand Up @@ -107,6 +109,7 @@
<path.source_10>src</path.source_10>
<path.source_12>src</path.source_12>
<path.source_14>src</path.source_14>
<path.source_16>src</path.source_16>
<path.target>output/ojava_8</path.target>
<javac.arguments></javac.arguments>
</properties>
Expand Down Expand Up @@ -136,6 +139,7 @@
<path.source_10>src_10</path.source_10>
<path.source_12>src</path.source_12>
<path.source_14>src</path.source_14>
<path.source_16>src</path.source_16>
<path.target>output/java_10</path.target>
<javac.arguments></javac.arguments>
</properties>
Expand Down Expand Up @@ -165,6 +169,7 @@
<path.source_10>src_10</path.source_10>
<path.source_12>src_12</path.source_12>
<path.source_14>src</path.source_14>
<path.source_16>src</path.source_16>
<path.target>output/java_12</path.target>
<javac.arguments>--enable-preview</javac.arguments>
</properties>
Expand Down Expand Up @@ -194,6 +199,7 @@
<path.source_10>src_10</path.source_10>
<path.source_12>src_12</path.source_12>
<path.source_14>src</path.source_14>
<path.source_16>src</path.source_16>
<path.target>output/java_13</path.target>
<javac.arguments>--enable-preview</javac.arguments>
</properties>
Expand Down Expand Up @@ -223,6 +229,7 @@
<path.source_10>src_10</path.source_10>
<path.source_12>src_12</path.source_12>
<path.source_14>src_14</path.source_14>
<path.source_16>src</path.source_16>
<path.target>output/java_14</path.target>
<javac.arguments>--enable-preview</javac.arguments>
</properties>
Expand Down Expand Up @@ -252,8 +259,9 @@
<path.source_10>src_10</path.source_10>
<path.source_12>src_12</path.source_12>
<path.source_14>src_14</path.source_14>
<path.source_16>src_16</path.source_16>
<path.target>output/java_16</path.target>
<javac.arguments></javac.arguments>
<javac.arguments>--enable-preview</javac.arguments>
</properties>
<build>
<plugins>
Expand All @@ -280,6 +288,7 @@
<path.source_10>src</path.source_10>
<path.source_12>src</path.source_12>
<path.source_14>src</path.source_14>
<path.source_16>src</path.source_16>
<path.target>output/ecj_8</path.target>
<javac.arguments></javac.arguments>
</properties>
Expand Down Expand Up @@ -326,6 +335,7 @@
<source>${path.source_10}</source>
<source>${path.source_12}</source>
<source>${path.source_14}</source>
<source>${path.source_16}</source>
</sources>
</configuration>
</execution>
Expand Down
5 changes: 5 additions & 0 deletions src_16/org/benf/cfr/tests/ImplSealedInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.benf.cfr.tests;

public non-sealed class ImplSealedInterface implements SealedInterface2 {
public void doIt() {}
}
4 changes: 4 additions & 0 deletions src_16/org/benf/cfr/tests/SealedCircle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.benf.cfr.tests;

public final class SealedCircle extends SealedShape {
}
13 changes: 13 additions & 0 deletions src_16/org/benf/cfr/tests/SealedInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.benf.cfr.tests;

public sealed interface SealedInterface {
void doIt();

public final class A implements SealedInterface {
public void doIt() {}
}

public non-sealed class B implements SealedInterface {
public void doIt() {}
}
}
7 changes: 7 additions & 0 deletions src_16/org/benf/cfr/tests/SealedInterface2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.benf.cfr.tests;

public sealed

interface SealedInterface2 permits ImplSealedInterface {
void doIt();
}
4 changes: 4 additions & 0 deletions src_16/org/benf/cfr/tests/SealedRectangle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.benf.cfr.tests;

public final class SealedRectangle extends SealedShape {
}
5 changes: 5 additions & 0 deletions src_16/org/benf/cfr/tests/SealedShape.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.benf.cfr.tests;

public abstract sealed class SealedShape
permits SealedCircle, SealedRectangle, SealedSquare {
}
4 changes: 4 additions & 0 deletions src_16/org/benf/cfr/tests/SealedSquare.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.benf.cfr.tests;

public non-sealed class SealedSquare extends SealedShape {
}

0 comments on commit b8412d2

Please sign in to comment.