mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8206986: Compiler support for Switch Expressions (Preview)
8207405: Compiler Tree API support for Switch Expressions (Preview) Support for switch expression, switch with rules and multiple constants for cases. Reviewed-by: jjg, mcimadamore, vromero
This commit is contained in:
parent
3f4b55c4df
commit
b3b644438e
121 changed files with 4753 additions and 268 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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
|
||||
|
@ -47,11 +47,14 @@
|
|||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.tools.*;
|
||||
|
||||
import com.sun.source.tree.CaseTree.CaseKind;
|
||||
import com.sun.source.tree.Tree;
|
||||
import com.sun.source.util.TreeScanner;
|
||||
import com.sun.tools.javac.tree.JCTree;
|
||||
import com.sun.tools.javac.tree.JCTree.JCCase;
|
||||
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
|
||||
import com.sun.tools.javac.tree.JCTree.JCModuleDecl;
|
||||
import com.sun.tools.javac.tree.JCTree.TypeBoundKind;
|
||||
|
@ -150,6 +153,11 @@ public class SourceTreeScannerTest extends AbstractTreeScannerTest {
|
|||
// The modifiers will not found by TreeScanner,
|
||||
// but the embedded annotations will be.
|
||||
reflectiveScan(((JCModuleDecl) tree).mods.annotations);
|
||||
} else if (tree instanceof JCCase &&
|
||||
((JCCase) tree).getCaseKind() == CaseKind.RULE &&
|
||||
f.getName().equals("stats")) {
|
||||
//value case, visit value:
|
||||
reflectiveScan(((JCCase) tree).getBody());
|
||||
} else {
|
||||
reflectiveScan(f.get(tree));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue