mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] raw string literals: language level check (IDEA-189075)
This commit is contained in:
+2
-1
@@ -2897,7 +2897,8 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
INTERSECTION_CASTS(LanguageLevel.JDK_1_8, "feature.intersections.in.casts"),
|
||||
STATIC_INTERFACE_CALLS(LanguageLevel.JDK_1_8, "feature.static.interface.calls"),
|
||||
REFS_AS_RESOURCE(LanguageLevel.JDK_1_9, "feature.try.with.resources.refs"),
|
||||
MODULES(LanguageLevel.JDK_1_9, "feature.modules");
|
||||
MODULES(LanguageLevel.JDK_1_9, "feature.modules"),
|
||||
RAW_LITERALS(LanguageLevel.JDK_11_PREVIEW, "feature.raw.literals");
|
||||
|
||||
private final LanguageLevel level;
|
||||
private final String key;
|
||||
|
||||
+3
@@ -459,6 +459,9 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
@Override
|
||||
public void visitJavaToken(PsiJavaToken token) {
|
||||
super.visitJavaToken(token);
|
||||
if (!myHolder.hasErrorResults() && token.getTokenType() == JavaTokenType.RAW_STRING_LITERAL) {
|
||||
myHolder.add(checkFeature(token, Feature.RAW_LITERALS));
|
||||
}
|
||||
if (!myHolder.hasErrorResults() && token.getTokenType() == JavaTokenType.RBRACE && token.getParent() instanceof PsiCodeBlock) {
|
||||
PsiElement gParent = token.getParent().getParent();
|
||||
PsiCodeBlock codeBlock;
|
||||
|
||||
@@ -463,4 +463,5 @@ feature.intersections.in.casts=Intersection types in casts
|
||||
feature.static.interface.calls=Static interface method calls
|
||||
feature.try.with.resources.refs=Resource references
|
||||
feature.modules=Modules
|
||||
feature.raw.literals=Raw string literals
|
||||
insufficient.language.level={0} are not supported at language level ''{1}''
|
||||
|
||||
+2
@@ -20,5 +20,7 @@ class UnsupportedFeatures {
|
||||
|
||||
java.lang.annotation.ElementType t = null;
|
||||
switch (<error descr="Incompatible types. Found: 'java.lang.annotation.ElementType', required: 'byte, char, short or int'">t</error>) { }
|
||||
|
||||
String raw = <error descr="Raw string literals are not supported at language level '1.4'">`hi there`</error>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user