equal
deleted
inserted
replaced
30 import java.util.stream.Collectors; |
30 import java.util.stream.Collectors; |
31 |
31 |
32 import javax.lang.model.element.ElementKind; |
32 import javax.lang.model.element.ElementKind; |
33 import javax.tools.JavaFileObject; |
33 import javax.tools.JavaFileObject; |
34 |
34 |
35 import com.sun.source.tree.CaseTree.CaseKind; |
35 import com.sun.source.tree.CaseTree; |
36 import com.sun.source.tree.IdentifierTree; |
36 import com.sun.source.tree.IdentifierTree; |
37 import com.sun.source.tree.MemberReferenceTree.ReferenceMode; |
37 import com.sun.source.tree.MemberReferenceTree.ReferenceMode; |
38 import com.sun.source.tree.MemberSelectTree; |
38 import com.sun.source.tree.MemberSelectTree; |
39 import com.sun.source.tree.TreeVisitor; |
39 import com.sun.source.tree.TreeVisitor; |
40 import com.sun.source.util.SimpleTreeVisitor; |
40 import com.sun.source.util.SimpleTreeVisitor; |
1484 |
1484 |
1485 // Attribute all cases and |
1485 // Attribute all cases and |
1486 // check that there are no duplicate case labels or default clauses. |
1486 // check that there are no duplicate case labels or default clauses. |
1487 Set<Object> labels = new HashSet<>(); // The set of case labels. |
1487 Set<Object> labels = new HashSet<>(); // The set of case labels. |
1488 boolean hasDefault = false; // Is there a default label? |
1488 boolean hasDefault = false; // Is there a default label? |
1489 @SuppressWarnings("removal") |
1489 @SuppressWarnings("preview") |
1490 CaseKind caseKind = null; |
1490 CaseTree.CaseKind caseKind = null; |
1491 boolean wasError = false; |
1491 boolean wasError = false; |
1492 for (List<JCCase> l = cases; l.nonEmpty(); l = l.tail) { |
1492 for (List<JCCase> l = cases; l.nonEmpty(); l = l.tail) { |
1493 JCCase c = l.head; |
1493 JCCase c = l.head; |
1494 if (caseKind == null) { |
1494 if (caseKind == null) { |
1495 caseKind = c.caseKind; |
1495 caseKind = c.caseKind; |
4090 |
4090 |
4091 if (sym.name != names.init || tree.hasTag(REFERENCE)) { |
4091 if (sym.name != names.init || tree.hasTag(REFERENCE)) { |
4092 chk.checkDeprecated(tree.pos(), env.info.scope.owner, sym); |
4092 chk.checkDeprecated(tree.pos(), env.info.scope.owner, sym); |
4093 chk.checkSunAPI(tree.pos(), sym); |
4093 chk.checkSunAPI(tree.pos(), sym); |
4094 chk.checkProfile(tree.pos(), sym); |
4094 chk.checkProfile(tree.pos(), sym); |
|
4095 chk.checkPreview(tree.pos(), sym); |
4095 } |
4096 } |
4096 |
4097 |
4097 // If symbol is a variable, check that its type and |
4098 // If symbol is a variable, check that its type and |
4098 // kind are compatible with the prototype and protokind. |
4099 // kind are compatible with the prototype and protokind. |
4099 return check(tree, owntype, sym.kind.toSelector(), resultInfo); |
4100 return check(tree, owntype, sym.kind.toSelector(), resultInfo); |