mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+4
-2
@@ -38,6 +38,7 @@ import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.rt.compiler.JavacRunner;
|
||||
@@ -295,9 +296,10 @@ public class JavacCompiler extends ExternalCompiler {
|
||||
additionalOptions.add("-processorpath");
|
||||
additionalOptions.add(FileUtil.toSystemDependentName(processorPath));
|
||||
}
|
||||
for (String processorName : config.getProcessors()) {
|
||||
final Set<String> processors = config.getProcessors();
|
||||
if (!processors.isEmpty()) {
|
||||
additionalOptions.add("-processor");
|
||||
additionalOptions.add(processorName);
|
||||
additionalOptions.add(StringUtil.join(processors, ","));
|
||||
}
|
||||
for (Map.Entry<String, String> entry : config.getProcessorOptions().entrySet()) {
|
||||
additionalOptions.add("-A" + entry.getKey() + "=" +entry.getValue());
|
||||
|
||||
@@ -337,6 +337,9 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
final Map<File, Set<File>> outs = buildOutputDirectoriesMap(context, chunk);
|
||||
final List<String> options = getCompilationOptions(context, chunk, profile);
|
||||
final ClassProcessingConsumer classesConsumer = new ClassProcessingConsumer(context, outputSink);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Compiling chunk [" + chunk.getName() + "] with options: \"" + StringUtil.join(options, " ") + "\"");
|
||||
}
|
||||
try {
|
||||
final boolean rc;
|
||||
if (USE_EMBEDDED_JAVAC) {
|
||||
@@ -590,9 +593,10 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
options.add(processorsPath == null? "" : FileUtil.toSystemDependentName(processorsPath.trim()));
|
||||
}
|
||||
|
||||
for (String procFQName : profile.getProcessors()) {
|
||||
final Set<String> processors = profile.getProcessors();
|
||||
if (!processors.isEmpty()) {
|
||||
options.add("-processor");
|
||||
options.add(procFQName);
|
||||
options.add(StringUtil.join(processors, ","));
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> optionEntry : profile.getProcessorOptions().entrySet()) {
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class AnnotationProcessorProfileSerializer {
|
||||
profile.clearProcessors();
|
||||
for (Object procElement : element.getChildren("processor")) {
|
||||
final String name = ((Element)procElement).getAttributeValue(NAME);
|
||||
if (StringUtil.isEmptyOrSpaces(name)) {
|
||||
if (!StringUtil.isEmptyOrSpaces(name)) {
|
||||
profile.addProcessor(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CompositeFilter implements Filter, FilterMixin {
|
||||
Result result = filter.applyFilter(line, entireLength);
|
||||
finalResult = merge(finalResult, result);
|
||||
t0 = System.currentTimeMillis() - t0;
|
||||
if (t0 > 100) {
|
||||
if (t0 > 1000) {
|
||||
LOG.warn(filter.getClass().getSimpleName() + ".applyFilter() took " + t0 + " ms on '''" + line + "'''");
|
||||
}
|
||||
if (finalResult != null && finalResult.getNextAction() == NextAction.EXIT) {
|
||||
|
||||
+49
-17
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -606,30 +606,62 @@ public class GrReferenceExpressionImpl extends GrReferenceElementImpl<GrExpressi
|
||||
}
|
||||
|
||||
if (resolved == null) {
|
||||
if ("class".equals(getReferenceName())) {
|
||||
return TypesUtil.createJavaLangClassType(GrReferenceResolveUtil.getQualifierType(this), getProject(), getResolveScope());
|
||||
final PsiType fromClassRef = getTypeFromClassRef(this);
|
||||
if (fromClassRef != null) {
|
||||
return fromClassRef;
|
||||
}
|
||||
|
||||
//map access
|
||||
GrExpression qualifier = getQualifierExpression();
|
||||
if (qualifier != null) {
|
||||
PsiType qType = qualifier.getNominalType();
|
||||
if (qType instanceof PsiClassType) {
|
||||
PsiClassType.ClassResolveResult qResult = ((PsiClassType)qType).resolveGenerics();
|
||||
PsiClass clazz = qResult.getElement();
|
||||
if (clazz != null) {
|
||||
PsiClass mapClass = JavaPsiFacade.getInstance(getProject()).findClass(CommonClassNames.JAVA_UTIL_MAP, getResolveScope());
|
||||
if (mapClass != null && mapClass.getTypeParameters().length == 2) {
|
||||
PsiSubstitutor substitutor = TypeConversionUtil.getClassSubstitutor(mapClass, clazz, qResult.getSubstitutor());
|
||||
if (substitutor != null) {
|
||||
return TypeConversionUtil.erasure(substitutor.substitute(mapClass.getTypeParameters()[1]));
|
||||
}
|
||||
final PsiType fromMapAccess = getTypeFromMapAccess(this);
|
||||
if (fromMapAccess != null) {
|
||||
return fromMapAccess;
|
||||
}
|
||||
|
||||
final PsiType fromSpreadOperator = getTypeFromSpreadOperator(this);
|
||||
if (fromSpreadOperator != null) {
|
||||
return fromSpreadOperator;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiType getTypeFromMapAccess(@NotNull GrReferenceExpressionImpl ref) {
|
||||
//map access
|
||||
GrExpression qualifier = ref.getQualifierExpression();
|
||||
if (qualifier != null) {
|
||||
PsiType qType = qualifier.getNominalType();
|
||||
if (qType instanceof PsiClassType) {
|
||||
PsiClassType.ClassResolveResult qResult = ((PsiClassType)qType).resolveGenerics();
|
||||
PsiClass clazz = qResult.getElement();
|
||||
if (clazz != null) {
|
||||
PsiClass mapClass = JavaPsiFacade.getInstance(ref.getProject()).findClass(CommonClassNames.JAVA_UTIL_MAP, ref.getResolveScope());
|
||||
if (mapClass != null && mapClass.getTypeParameters().length == 2) {
|
||||
PsiSubstitutor substitutor = TypeConversionUtil.getClassSubstitutor(mapClass, clazz, qResult.getSubstitutor());
|
||||
if (substitutor != null) {
|
||||
return TypeConversionUtil.erasure(substitutor.substitute(mapClass.getTypeParameters()[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiType getTypeFromSpreadOperator(@NotNull GrReferenceExpressionImpl ref) {
|
||||
if (ref.getDotTokenType() == GroovyTokenTypes.mSPREAD_DOT) {
|
||||
return TypesUtil.createType(CommonClassNames.JAVA_UTIL_LIST, ref);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiType getTypeFromClassRef(@NotNull GrReferenceExpressionImpl ref) {
|
||||
if ("class".equals(ref.getReferenceName())) {
|
||||
return TypesUtil.createJavaLangClassType(GrReferenceResolveUtil.getQualifierType(ref), ref.getProject(), ref.getResolveScope());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+8
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -579,6 +579,12 @@ def foo(def var) {
|
||||
''', 'java.lang.String')
|
||||
}
|
||||
|
||||
void testUnresolvedSpread() {
|
||||
doTest('''\
|
||||
def xxx = abc*.name
|
||||
print xx<caret>x''', 'java.util.List')
|
||||
}
|
||||
|
||||
private void doTest(String text, String type) {
|
||||
def file = myFixture.configureByText('_.groovy', text)
|
||||
def ref = file.findReferenceAt(myFixture.editor.caretModel.offset) as GrReferenceExpression
|
||||
@@ -607,4 +613,5 @@ def foo(def var) {
|
||||
}
|
||||
return b.toString()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user