Add records feature and validation

GitOrigin-RevId: fc64ecd6fe81020abbcccaacf1b447e0ad2ab678
This commit is contained in:
Roman.Ivanov
2019-12-05 04:41:15 +00:00
committed by intellij-monorepo-bot
parent 61e6a503c8
commit f297157108
4 changed files with 10 additions and 1 deletions
@@ -3119,7 +3119,8 @@ public class HighlightUtil extends HighlightUtilBase {
return useSiteLevel.isAtLeast(LanguageLevel.JDK_13_PREVIEW);//enabled in jdk 14 as standard
}
},
TEXT_BLOCKS(LanguageLevel.JDK_13_PREVIEW, "feature.text.blocks");
TEXT_BLOCKS(LanguageLevel.JDK_13_PREVIEW, "feature.text.blocks"),
RECORDS(LanguageLevel.JDK_14, "feature.records");
private final LanguageLevel level;
private final String key;
@@ -509,6 +509,9 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
if (!myHolder.hasErrorResults() && type == JavaTokenType.TEXT_BLOCK_LITERAL) {
myHolder.add(checkFeature(token, Feature.TEXT_BLOCKS));
}
else if (!myHolder.hasErrorResults() && type == JavaTokenType.RECORD_KEYWORD) {
myHolder.add(checkFeature(token, Feature.RECORDS));
}
if (!myHolder.hasErrorResults() && type == JavaTokenType.RBRACE && token.getParent() instanceof PsiCodeBlock) {
PsiElement gParent = token.getParent().getParent();
@@ -488,4 +488,5 @@ feature.modules=Modules
feature.text.blocks=Text block literals
feature.enhanced.switch=Enhanced 'switch' blocks
feature.switch.expressions='switch' expressions
feature.records=Records
insufficient.language.level={0} are not supported at language level ''{1}''
@@ -23,4 +23,8 @@ class UnsupportedFeatures {
String raw = <error descr="Text block literals are not supported at language level '1.4'">"""hi there"""</error>;
}
}
<error descr="Records are not supported at language level '1.4'">record</error> UnsuportedRecord(String s) {
}