mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (formatting; typos)
This commit is contained in:
+58
-58
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1019,89 +1019,90 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
parent instanceof PsiPrefixExpression &&
|
||||
((PsiPrefixExpression)parent).getOperationTokenType() == JavaTokenType.MINUS)) {
|
||||
if (text.equals(PsiLiteralExpressionImpl.HEX_PREFIX)) {
|
||||
final String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
if (text.equals(PsiLiteralExpressionImpl.BIN_PREFIX)) {
|
||||
final String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
if (value == null || text.equals(PsiLiteralExpressionImpl._2_IN_31)) {
|
||||
final String message = JavaErrorMessages.message("integer.number.too.large");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("integer.number.too.large");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == JavaTokenType.LONG_LITERAL) {
|
||||
final String mText = text.endsWith("l") ? text.substring(0, text.length() - 1) : text;
|
||||
String mText = text.endsWith("l") ? text.substring(0, text.length() - 1) : text;
|
||||
//literal 9223372036854775808L may appear only as the operand of the unary negation operator -.
|
||||
if (!(mText.equals(PsiLiteralExpressionImpl._2_IN_63) &&
|
||||
parent instanceof PsiPrefixExpression &&
|
||||
((PsiPrefixExpression)parent).getOperationTokenType() == JavaTokenType.MINUS)) {
|
||||
if (mText.equals(PsiLiteralExpressionImpl.HEX_PREFIX)) {
|
||||
final String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
if (mText.equals(PsiLiteralExpressionImpl.BIN_PREFIX)) {
|
||||
final String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
if (value == null || mText.equals(PsiLiteralExpressionImpl._2_IN_63)) {
|
||||
final String message = JavaErrorMessages.message("long.number.too.large");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("long.number.too.large");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isFP) {
|
||||
if (value == null) {
|
||||
final String message = JavaErrorMessages.message("malformed.floating.point.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("malformed.floating.point.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
}
|
||||
else if (type == JavaTokenType.CHARACTER_LITERAL) {
|
||||
// todo[r.sh] clean this mess up
|
||||
if (value != null) {
|
||||
if (!StringUtil.endsWithChar(text, '\'')) {
|
||||
final String message = JavaErrorMessages.message("unclosed.char.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("unclosed.char.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!StringUtil.startsWithChar(text, '\'')) return null;
|
||||
if (!StringUtil.startsWithChar(text, '\'')) {
|
||||
return null;
|
||||
}
|
||||
if (StringUtil.endsWithChar(text, '\'')) {
|
||||
if (text.length() == 1) {
|
||||
final String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
text = text.substring(1, text.length() - 1);
|
||||
}
|
||||
else {
|
||||
final String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
|
||||
StringBuilder chars = new StringBuilder();
|
||||
final boolean success = PsiLiteralExpressionImpl.parseStringCharacters(text, chars, null);
|
||||
boolean success = PsiLiteralExpressionImpl.parseStringCharacters(text, chars, null);
|
||||
if (!success) {
|
||||
final String message = JavaErrorMessages.message("illegal.escape.character.in.character.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("illegal.escape.character.in.character.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
int length = chars.length();
|
||||
if (length > 1) {
|
||||
final String message = JavaErrorMessages.message("too.many.characters.in.character.literal");
|
||||
final HighlightInfo info =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("too.many.characters.in.character.literal");
|
||||
HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createConvertToStringLiteralAction());
|
||||
return info;
|
||||
}
|
||||
else if (length == 0) {
|
||||
final String message = JavaErrorMessages.message("empty.character.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("empty.character.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == JavaTokenType.STRING_LITERAL) {
|
||||
if (value == null) {
|
||||
for (final PsiElement element : expression.getChildren()) {
|
||||
for (PsiElement element : expression.getChildren()) {
|
||||
if (element instanceof OuterLanguageElement) {
|
||||
return null;
|
||||
}
|
||||
@@ -1110,44 +1111,45 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
if (!StringUtil.startsWithChar(text, '\"')) return null;
|
||||
if (StringUtil.endsWithChar(text, '\"')) {
|
||||
if (text.length() == 1) {
|
||||
final String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
text = text.substring(1, text.length() - 1);
|
||||
}
|
||||
else {
|
||||
final String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
|
||||
StringBuilder chars = new StringBuilder();
|
||||
boolean success = PsiLiteralExpressionImpl.parseStringCharacters(text, chars, null);
|
||||
if (!success) {
|
||||
final String message = JavaErrorMessages.message("illegal.escape.character.in.string.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("illegal.escape.character.in.string.literal");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (value instanceof Float) {
|
||||
final Float number = (Float)value;
|
||||
Float number = (Float)value;
|
||||
if (number.isInfinite()) {
|
||||
final String message = JavaErrorMessages.message("floating.point.number.too.large");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("floating.point.number.too.large");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
if (number.floatValue() == 0 && !TypeConversionUtil.isFPZero(text)) {
|
||||
final String message = JavaErrorMessages.message("floating.point.number.too.small");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("floating.point.number.too.small");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
}
|
||||
else if (value instanceof Double) {
|
||||
final Double number = (Double)value;
|
||||
Double number = (Double)value;
|
||||
if (number.isInfinite()) {
|
||||
final String message = JavaErrorMessages.message("floating.point.number.too.large");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("floating.point.number.too.large");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
if (number.doubleValue() == 0 && !TypeConversionUtil.isFPZero(text)) {
|
||||
final String message = JavaErrorMessages.message("floating.point.number.too.small");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
String message = JavaErrorMessages.message("floating.point.number.too.small");
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1749,23 +1751,22 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static HighlightInfo checkExpressionRequired(@NotNull PsiReferenceExpression expression,
|
||||
@NotNull JavaResolveResult resultForIncompleteCode) {
|
||||
static HighlightInfo checkExpressionRequired(@NotNull PsiReferenceExpression expression, @NotNull JavaResolveResult resultForIncompleteCode) {
|
||||
if (expression.getNextSibling() instanceof PsiErrorElement) return null;
|
||||
|
||||
PsiElement resolved = resultForIncompleteCode.getElement();
|
||||
if (resolved == null) return null;
|
||||
if (resolved == null || resolved instanceof PsiVariable) return null;
|
||||
|
||||
PsiElement parent = expression.getParent();
|
||||
// String.class or String() are both correct
|
||||
if (parent instanceof PsiReferenceExpression || parent instanceof PsiMethodCallExpression) return null;
|
||||
if (resolved instanceof PsiVariable) return null;
|
||||
|
||||
String description = JavaErrorMessages.message("expression.expected");
|
||||
final HighlightInfo info =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
|
||||
HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
|
||||
UnresolvedReferenceQuickFixProvider.registerReferenceFixes(expression, new QuickFixActionRegistrarImpl(info));
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
static HighlightInfo checkArrayInitializerApplicable(@NotNull PsiArrayInitializerExpression expression) {
|
||||
/*
|
||||
@@ -1782,8 +1783,7 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
}
|
||||
|
||||
String description = JavaErrorMessages.message("array.initializer.not.allowed");
|
||||
HighlightInfo info =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
|
||||
HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
|
||||
QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createAddNewArrayExpressionFix(expression));
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -357,7 +357,6 @@ public class PsiImplUtil {
|
||||
return TargetType.UNKNOWN;
|
||||
}
|
||||
|
||||
// todo[r.sh] cache?
|
||||
@Nullable
|
||||
public static Set<TargetType> getAnnotationTargets(@NotNull PsiClass annotationType) {
|
||||
if (!annotationType.isAnnotationType()) return null;
|
||||
@@ -393,38 +392,38 @@ public class PsiImplUtil {
|
||||
PsiUtilCore.ensureValid(expression);
|
||||
PsiUtil.ensureValidType(type);
|
||||
|
||||
PsiExpression toplevel = expression;
|
||||
while (toplevel.getParent() instanceof PsiArrayAccessExpression &&
|
||||
((PsiArrayAccessExpression)toplevel.getParent()).getArrayExpression() == toplevel) {
|
||||
toplevel = (PsiExpression)toplevel.getParent();
|
||||
PsiExpression topLevel = expression;
|
||||
while (topLevel.getParent() instanceof PsiArrayAccessExpression &&
|
||||
((PsiArrayAccessExpression)topLevel.getParent()).getArrayExpression() == topLevel) {
|
||||
topLevel = (PsiExpression)topLevel.getParent();
|
||||
}
|
||||
|
||||
if (toplevel instanceof PsiArrayAccessExpression && !PsiUtil.isAccessedForWriting(toplevel)) {
|
||||
if (topLevel instanceof PsiArrayAccessExpression && !PsiUtil.isAccessedForWriting(topLevel)) {
|
||||
return PsiUtil.captureToplevelWildcards(type, expression);
|
||||
}
|
||||
|
||||
final PsiType normalized = doNormalizeWildcardByPosition(type, expression, toplevel);
|
||||
final PsiType normalized = doNormalizeWildcardByPosition(type, expression, topLevel);
|
||||
LOG.assertTrue(normalized.isValid(), type);
|
||||
if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(toplevel)) {
|
||||
if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(topLevel)) {
|
||||
return PsiUtil.captureToplevelWildcards(normalized, expression);
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private static PsiType doNormalizeWildcardByPosition(final PsiType type, @NotNull PsiExpression expression, final PsiExpression toplevel) {
|
||||
private static PsiType doNormalizeWildcardByPosition(PsiType type, @NotNull PsiExpression expression, PsiExpression topLevel) {
|
||||
if (type instanceof PsiCapturedWildcardType) {
|
||||
final PsiWildcardType wildcardType = ((PsiCapturedWildcardType)type).getWildcard();
|
||||
if (expression instanceof PsiReferenceExpression && LambdaUtil.isLambdaReturnExpression(expression)) {
|
||||
return type;
|
||||
}
|
||||
|
||||
if (PsiUtil.isAccessedForWriting(toplevel)) {
|
||||
if (PsiUtil.isAccessedForWriting(topLevel)) {
|
||||
return wildcardType.isSuper() ? wildcardType.getBound() : PsiCapturedWildcardType.create(wildcardType, expression);
|
||||
}
|
||||
else {
|
||||
final PsiType upperBound = ((PsiCapturedWildcardType)type).getUpperBound();
|
||||
return upperBound instanceof PsiWildcardType ? doNormalizeWildcardByPosition(upperBound, expression, toplevel) : upperBound;
|
||||
return upperBound instanceof PsiWildcardType ? doNormalizeWildcardByPosition(upperBound, expression, topLevel) : upperBound;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +431,7 @@ public class PsiImplUtil {
|
||||
if (type instanceof PsiWildcardType) {
|
||||
final PsiWildcardType wildcardType = (PsiWildcardType)type;
|
||||
|
||||
if (PsiUtil.isAccessedForWriting(toplevel)) {
|
||||
if (PsiUtil.isAccessedForWriting(topLevel)) {
|
||||
return wildcardType.isSuper() ? wildcardType.getBound() : PsiCapturedWildcardType.create(wildcardType, expression);
|
||||
}
|
||||
else {
|
||||
@@ -446,7 +445,7 @@ public class PsiImplUtil {
|
||||
}
|
||||
else if (type instanceof PsiArrayType) {
|
||||
final PsiType componentType = ((PsiArrayType)type).getComponentType();
|
||||
final PsiType normalizedComponentType = doNormalizeWildcardByPosition(componentType, expression, toplevel);
|
||||
final PsiType normalizedComponentType = doNormalizeWildcardByPosition(componentType, expression, topLevel);
|
||||
if (normalizedComponentType != componentType) {
|
||||
return normalizedComponentType.createArrayType();
|
||||
}
|
||||
@@ -521,26 +520,34 @@ public class PsiImplUtil {
|
||||
@Nullable String attributeName,
|
||||
@Nullable PsiAnnotationMemberValue value,
|
||||
@NotNull PairFunction<Project, String, PsiAnnotation> annotationCreator) {
|
||||
final PsiAnnotationMemberValue existing = psiAnnotation.findDeclaredAttributeValue(attributeName);
|
||||
PsiAnnotationMemberValue existing = psiAnnotation.findDeclaredAttributeValue(attributeName);
|
||||
if (value == null) {
|
||||
if (existing == null) {
|
||||
return null;
|
||||
}
|
||||
existing.getParent().delete();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (existing != null) {
|
||||
((PsiNameValuePair)existing.getParent()).setValue(value);
|
||||
} else {
|
||||
final PsiNameValuePair[] attributes = psiAnnotation.getParameterList().getAttributes();
|
||||
if (attributes.length == 1 && attributes[0].getName() == null) {
|
||||
attributes[0].replace(createNameValuePair(attributes[0].getValue(), PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME + "=", annotationCreator));
|
||||
}
|
||||
else {
|
||||
PsiNameValuePair[] attributes = psiAnnotation.getParameterList().getAttributes();
|
||||
if (attributes.length == 1) {
|
||||
PsiNameValuePair attribute = attributes[0];
|
||||
if (attribute.getName() == null) {
|
||||
PsiAnnotationMemberValue defValue = attribute.getValue();
|
||||
assert defValue != null : attribute;
|
||||
attribute.replace(createNameValuePair(defValue, PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME + "=", annotationCreator));
|
||||
}
|
||||
}
|
||||
|
||||
boolean allowNoName = attributes.length == 0 && ("value".equals(attributeName) || null == attributeName);
|
||||
final String namePrefix;
|
||||
if (allowNoName) {
|
||||
namePrefix = "";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
namePrefix = attributeName + "=";
|
||||
}
|
||||
psiAnnotation.getParameterList().addBefore(createNameValuePair(value, namePrefix, annotationCreator), null);
|
||||
@@ -709,7 +716,8 @@ public class PsiImplUtil {
|
||||
if (typeName.indexOf('<') != -1 || typeName.indexOf('[') != -1 || typeName.indexOf('.') == -1) {
|
||||
try {
|
||||
return JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory().createTypeFromText(typeName, context);
|
||||
} catch(Exception ex) {} // invalid syntax will produce unresolved class type
|
||||
}
|
||||
catch(Exception ignored) { } // invalid syntax will produce unresolved class type
|
||||
}
|
||||
|
||||
PsiClass aClass = JavaPsiFacade.getInstance(psiManager.getProject()).findClass(typeName, context.getResolveScope());
|
||||
|
||||
Reference in New Issue
Block a user