Skip to content

Commit

Permalink
Fixing tests. (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Lahoda <[email protected]>
  • Loading branch information
biboudis and lahodaj authored Feb 8, 2025
1 parent 6c08011 commit 3466195
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
* @since 25
*/
@PreviewFeature(feature= PreviewFeature.Feature.PATTERN_DECLARATIONS, reflective=true)
public interface MatchFailTree extends StatementTree {
public interface MatchFailedTree extends StatementTree {
}
4 changes: 2 additions & 2 deletions src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java
Original file line number Diff line number Diff line change
Expand Up @@ -725,12 +725,12 @@ public enum Kind {
MATCH(MatchTree.class), //TODO: maybe MATCH_SUCCESS

/**
* Used for instances of {@link MatchFailTree}.
* Used for instances of {@link MatchFailedTree}.
*
* @since 25
*/
@PreviewFeature(feature=PreviewFeature.Feature.PATTERN_DECLARATIONS, reflective=true)
MATCH_FAILED(MatchFailTree.class),
MATCH_FAILED(MatchFailedTree.class),

;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,12 @@ public interface TreeVisitor<R,P> {
R visitMatchStatement(MatchTree node, P p);

/**
* Visits an {@code MatchFailTree} node.
* Visits an {@code MatchFailedTree} node.
* @param node the node being visited
* @param p a parameter value
* @return a result value
* @since 25
*/
@PreviewFeature(feature=PreviewFeature.Feature.PATTERN_DECLARATIONS, reflective=true)
R visitMatchFailStatement(MatchFailTree node, P p);
R visitMatchFailStatement(MatchFailedTree node, P p);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ public R visitMatchStatement(MatchTree node, P p) {
* @return the result of {@code defaultAction}
*/
@Override
public R visitMatchFailStatement(MatchFailTree node, P p) {
public R visitMatchFailStatement(MatchFailedTree node, P p) {
return defaultAction(node, p);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ public R visitMatchStatement(MatchTree node, P p) {
* @return the result of scanning
*/
@Override
public R visitMatchFailStatement(MatchFailTree node, P p) {
public R visitMatchFailStatement(MatchFailedTree node, P p) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public enum Flag {
DEPRECATED_ANNOTATION(Flags.DEPRECATED_ANNOTATION),
DEPRECATED_REMOVAL(Flags.DEPRECATED_REMOVAL),
HAS_RESOURCE(Flags.HAS_RESOURCE),
// Bit 48 is currently available
PARTIAL(Flags.PARTIAL),
ANONCONSTR_BASED(Flags.ANONCONSTR_BASED),
NAME_FILLED(Flags.NAME_FILLED),
PREVIEW_API(Flags.PREVIEW_API),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ public Tag getTag() {
/**
* The match-fail statement
*/
public static class JCMatchFail extends JCStatement implements MatchFailTree {
public static class JCMatchFail extends JCStatement implements MatchFailedTree {

protected JCMatchFail() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public JCTree visitMatchStatement(MatchTree node, P p) {
}

@DefinedBy(Api.COMPILER_TREE)
public JCTree visitMatchFailStatement(MatchFailTree node, P p) {
public JCTree visitMatchFailStatement(MatchFailedTree node, P p) {
JCMatchFail t = (JCMatchFail) node;

return M.at(t.pos).MatchFail();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

// key: compiler.misc.feature.pattern.declarations
// key: compiler.warn.preview.feature.use.plural
// key: compiler.err.unmarked.partial.deconstructor
// options: --enable-preview -source ${jdk.version} -Xlint:preview

class UnmarkedPartialDeconstructor {
public pattern UnmarkedPartialDeconstructor() {
match-fail();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public case pattern Test(String content) {
.writeAll()
.getOutput(Task.OutputKind.STDOUT);

String expectedOut = "OK\n";
String expectedOut = "OK" + System.getProperty("line.separator");

if (!Objects.equals(out, expectedOut)) {
throw new AssertionError("Unexpected output, expected: " + expectedOut +
Expand Down

0 comments on commit 3466195

Please sign in to comment.