From 7163bc883bb0302004e88d613a12df4c5714e04e Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 18 May 2015 21:03:20 +0300 Subject: [PATCH 1/5] removed unneeded dependency from testFramework-java on external-system-impl to reduce module cycle --- java/testFramework/testFramework-java.iml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/testFramework/testFramework-java.iml b/java/testFramework/testFramework-java.iml index ed67da5e161f..c5639a71f346 100644 --- a/java/testFramework/testFramework-java.iml +++ b/java/testFramework/testFramework-java.iml @@ -21,7 +21,6 @@ - @@ -30,5 +29,4 @@ - - + \ No newline at end of file From 368c4d56dfbbfc1a5247528b720ac24048685185 Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 18 May 2015 21:16:48 +0300 Subject: [PATCH 2/5] tests roots moved from java-impl to java-tests to avoid circular dependency between java-impl and testFramework-java --- java/java-impl/java-impl.iml | 5 ----- java/java-tests/java-tests.iml | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/java/java-impl/java-impl.iml b/java/java-impl/java-impl.iml index ee71056b6734..eb22a86d630c 100644 --- a/java/java-impl/java-impl.iml +++ b/java/java-impl/java-impl.iml @@ -8,15 +8,12 @@ - - - @@ -40,7 +37,6 @@ - @@ -52,7 +48,6 @@ - diff --git a/java/java-tests/java-tests.iml b/java/java-tests/java-tests.iml index ae3f097b542f..589ebadfdeed 100644 --- a/java/java-tests/java-tests.iml +++ b/java/java-tests/java-tests.iml @@ -5,6 +5,15 @@ + + + + + + + + + From c7eb1e1bc117a40f1bcd5d516792053a9b8fc0d9 Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 19 May 2015 10:27:51 +0300 Subject: [PATCH 3/5] added missing dependency --- plugins/groovy/jetgroovy.iml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/groovy/jetgroovy.iml b/plugins/groovy/jetgroovy.iml index c06341abadd7..ebecd0542410 100644 --- a/plugins/groovy/jetgroovy.iml +++ b/plugins/groovy/jetgroovy.iml @@ -38,5 +38,6 @@ + \ No newline at end of file From 615cc49b353df07b9562b2549ac89a0dd4d69e59 Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 19 May 2015 10:32:08 +0300 Subject: [PATCH 4/5] unpack JDKs: use 32-bit JVM on 32-bit Windows --- build/scripts/unpackJdks.gant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/unpackJdks.gant b/build/scripts/unpackJdks.gant index 8bb53c134348..7cd7c82b0577 100644 --- a/build/scripts/unpackJdks.gant +++ b/build/scripts/unpackJdks.gant @@ -49,7 +49,7 @@ def unpackJdks() { private void unpackJdk(File osDir, File jdkDir, String majorVersion) { def jdkFiles = osDir.listFiles().findAll { it.name.startsWith("jdk$majorVersion") } if (SystemInfo.isWindows) { - def arch = "x64" + def arch = System.getenv("ProgramFiles(x86)") != null ? "x64" : "x32" jdkFiles = jdkFiles.findAll { it.name.endsWith("_${arch}.zip") } } if (jdkFiles.empty) { From e58e1a868768f52b7d69724cd42667e9fe598b90 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 19 May 2015 10:18:18 +0200 Subject: [PATCH 5/5] groovy++ is dead, so remove its support --- .../UnassignedVariableAccessInspection.java | 2 - .../ConstructorReferencesSearcher.java | 3 +- .../GroovyConstructorUsagesSearcher.java | 177 ++---------------- .../LiteralConstructorReference.java | 8 - .../LiteralConstructorSearcher.java | 11 +- .../gpp/GppExpectedTypesContributor.java | 7 - .../groovy/gpp/GppImplicitUsageProvider.java | 59 ------ .../groovy/gpp/GppReferenceContributor.java | 7 - .../plugins/groovy/gpp/GppTypeConverter.java | 52 +---- .../groovy/lang/GroovyCoreEnvironment.java | 2 - .../typedef/members/GrMethodBaseImpl.java | 18 +- .../ast/AutoExternalizeContributor.java | 12 +- .../jps/incremental/groovy/GroovyBuilder.java | 5 +- plugins/groovy/src/META-INF/plugin.xml | 2 - .../gpp/GppLibraryPresentationProvider.java | 141 -------------- 15 files changed, 29 insertions(+), 477 deletions(-) delete mode 100644 plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppImplicitUsageProvider.java delete mode 100644 plugins/groovy/src/org/jetbrains/plugins/groovy/gpp/GppLibraryPresentationProvider.java diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/unassignedVariable/UnassignedVariableAccessInspection.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/unassignedVariable/UnassignedVariableAccessInspection.java index 2c4e1dd018f9..54384ef29260 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/unassignedVariable/UnassignedVariableAccessInspection.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/unassignedVariable/UnassignedVariableAccessInspection.java @@ -29,7 +29,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.codeInspection.GrInspectionUtil; import org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle; import org.jetbrains.plugins.groovy.codeInspection.GroovyLocalInspectionBase; -import org.jetbrains.plugins.groovy.gpp.GppTypeConverter; import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; import org.jetbrains.plugins.groovy.lang.psi.GrControlFlowOwner; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement; @@ -100,7 +99,6 @@ public class UnassignedVariableAccessInspection extends GroovyLocalInspectionBas !(property instanceof PsiParameter) && !(property instanceof PsiField) && PsiTreeUtil.isAncestor(owner, property, false) && - !GppTypeConverter.hasTypedContext(element) && !(myIgnoreBooleanExpressions && isBooleanCheck(element)) ) { problemsHolder.registerProblem(element, GroovyInspectionBundle.message("unassigned.access.tooltip", name)); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/ConstructorReferencesSearcher.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/ConstructorReferencesSearcher.java index e43ef29ad2be..50badf95137f 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/ConstructorReferencesSearcher.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/ConstructorReferencesSearcher.java @@ -37,7 +37,8 @@ public class ConstructorReferencesSearcher extends QueryExecutorBase consumer) { - processConstructorUsages(p.getMethod(), p.getEffectiveSearchScope(), consumer, p.getOptimizer(), true, !p.isStrictSignatureSearch()); + processConstructorUsages(p.getMethod(), p.getEffectiveSearchScope(), consumer, p.getOptimizer(), !p.isStrictSignatureSearch()); } public static final Key> LITERALLY_CONSTRUCTED_CLASSES = Key.create("LITERALLY_CONSTRUCTED_CLASSES"); - static void processConstructorUsages(final PsiMethod constructor, final SearchScope searchScope, final Processor consumer, final SearchRequestCollector collector, final boolean searchGppCalls, final boolean includeOverloads) { + static void processConstructorUsages(final PsiMethod constructor, + final SearchScope searchScope, + final Processor consumer, + final SearchRequestCollector collector, + final boolean includeOverloads) { if (!constructor.isConstructor()) return; final PsiClass clazz = constructor.getContainingClass(); @@ -116,7 +110,7 @@ public class GroovyConstructorUsagesSearcher extends QueryExecutorBase newExpressionProcessor, final LiteralConstructorSearcher literalProcessor) { - final Set processedMethods = ContainerUtil.newConcurrentSet(); - ReferencesSearch.searchOptimized(clazz, scope, false, collector, true, new PairProcessor() { @Override public boolean process(PsiReference ref, SearchRequestCollector collector) { final PsiElement element = ref.getElement(); if (element instanceof GrCodeReferenceElement) { - if (!processGroovyConstructorUsages((GrCodeReferenceElement)element, !searchGppCalls, newExpressionProcessor, literalProcessor)) { + if (!processGroovyConstructorUsages((GrCodeReferenceElement)element, newExpressionProcessor, literalProcessor)) { return false; } } - if (searchGppCalls) { - final PsiMethod method = getMethodToSearchForCallsWithLiteralArguments(element, clazz); - if (method != null && processedMethods.add(PsiAnchor.create(method))) { - processGppMethodCalls(clazz, scope, collector, method, literalProcessor); - } - } return true; } }); } - @Nullable - private static PsiMethod getMethodToSearchForCallsWithLiteralArguments(PsiElement element, PsiClass targetClass) { - final PsiParameter parameter = PsiTreeUtil.getParentOfType(element, PsiParameter.class); - if (parameter != null) { - final PsiMethod method = PsiTreeUtil.getParentOfType(parameter, PsiMethod.class); - if (method != null) { - final PsiParameter[] parameters = method.getParameterList().getParameters(); - final int idx = Arrays.asList(parameters).indexOf(parameter); - if (idx >= 0) { - PsiType parameterType = parameter.getType(); - if (parameterType instanceof PsiArrayType && idx == parameters.length - 1) { - parameterType = ((PsiArrayType)parameterType).getComponentType(); - } - if (parameterType instanceof PsiClassType) { - if (method.getManager().areElementsEquivalent(targetClass, ((PsiClassType)parameterType).resolve())) { - return method; - } - } - } - } - } - return null; - } - - private static void processGppMethodCalls(final PsiClass targetClass, - SearchScope scope, - SearchRequestCollector originalCollector, @NotNull PsiMethod currentTarget, - final LiteralConstructorSearcher literalProcessor) { - final SearchScope gppScope = getGppScope(targetClass.getProject()).intersectWith(scope); - - if (gppScope instanceof GlobalSearchScope) { - String name = currentTarget.getName(); - if (PsiSearchHelper.SERVICE.getInstance(currentTarget.getProject()).isCheapEnoughToSearch(name, (GlobalSearchScope)gppScope, null, - null) == - PsiSearchHelper.SearchCostResult.ZERO_OCCURRENCES) { - return; - } - } - - final ReadActionProcessor gppCallProcessor = new ReadActionProcessor() { - - @Nullable - private GrExpression[] getCallArguments(PsiReference psiReference) { - if (psiReference instanceof GrReferenceElement) { - final PsiElement parent = ((GrReferenceElement)psiReference).getParent(); - if (parent instanceof GrCall) { - final GrArgumentList argList = ((GrCall)parent).getArgumentList(); - if (argList != null) { - return argList.getExpressionArguments(); - } - } - } - else if (psiReference instanceof LiteralConstructorReference) { - return ((LiteralConstructorReference)psiReference).getCallArguments(); - } - return null; - } - - @Override - public boolean processInReadAction(PsiReference psiReference) { - final GrExpression[] arguments = getCallArguments(psiReference); - if (arguments == null) { - return true; - } - - boolean checkedTypedContext = false; - for (GrExpression argument : arguments) { - if (argument instanceof GrListOrMap) { - if (!checkedTypedContext) { - if (!GppTypeConverter.hasTypedContext(psiReference.getElement())) { - return true; - } - checkedTypedContext = true; - } - - if (!literalProcessor.processLiteral((GrListOrMap)argument, true)) { - return false; - } - } - } - return true; - } - }; - if (currentTarget.isConstructor()) { - processConstructorUsages(currentTarget, gppScope, gppCallProcessor, originalCollector, true, false); - } - else { - MethodReferencesSearch.searchOptimized(currentTarget, gppScope, true, originalCollector, gppCallProcessor); - } - } - - private static GlobalSearchScope getGppScope(final Project project) { - return CachedValuesManager.getManager(project).getCachedValue(project, new CachedValueProvider() { - @Override - public Result compute() { - return Result.create(calcGppScope(project), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, ProjectRootManager.getInstance(project)); - } - }); - } - private static boolean processGroovyConstructorUsages(GrCodeReferenceElement element, - boolean usualCallsOnly, final Processor newExpressionProcessor, final LiteralConstructorSearcher literalProcessor) { PsiElement parent = element.getParent(); @@ -279,10 +163,6 @@ public class GroovyConstructorUsagesSearcher extends QueryExecutorBase files = new HashSet(); - AnnotatedElementsSearch.searchElements(typed, maximal, PsiModifierListOwner.class).forEach(new Processor() { - @Override - public boolean process(PsiModifierListOwner occurrence) { - ContainerUtil.addIfNotNull(occurrence.getContainingFile().getVirtualFile(), files); - return true; - } - }); - - GlobalSearchScope withTypedAnno = GlobalSearchScope.filesScope(project, files); - return withTypedAnno.union(gppExtensions); - } - - return gppExtensions; - } - private static boolean checkLiteralInstantiation(GrExpression expression, final LiteralConstructorSearcher literalProcessor) { if (expression instanceof GrListOrMap) { - return literalProcessor.processLiteral((GrListOrMap)expression, GppTypeConverter.hasTypedContext(expression)); + return literalProcessor.processLiteral((GrListOrMap)expression); } return true; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/LiteralConstructorReference.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/LiteralConstructorReference.java index 315488a085b1..2d1810f5bfa2 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/LiteralConstructorReference.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/LiteralConstructorReference.java @@ -24,12 +24,10 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.codeInspection.utils.ControlFlowUtils; -import org.jetbrains.plugins.groovy.gpp.GppTypeConverter; import org.jetbrains.plugins.groovy.lang.psi.GrControlFlowOwner; import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList; import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument; import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrOpenBlock; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrAssignmentExpression; @@ -116,12 +114,6 @@ public class LiteralConstructorReference extends PsiReferenceBase.Poly applicable = addMethodCandidates(classType, value); final String memberName = getValue(); - if ("super".equals(memberName) && GppTypeConverter.hasTypedContext(myElement)) { - final LiteralConstructorReference reference = (LiteralConstructorReference)map.getReference(); - if (reference != null && reference.getConstructedClassType() != null) { - return reference.multiResolve(incompleteCode); - } - } - if (value == null || applicable.isEmpty()) { final PsiMethod setter = PropertyUtil.findPropertySetter(psiClass, memberName, false, true); if (setter != null) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppTypeConverter.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppTypeConverter.java index 817e47055e80..f742ade7d52c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppTypeConverter.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppTypeConverter.java @@ -15,18 +15,15 @@ */ package org.jetbrains.plugins.groovy.gpp; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.psi.*; +import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiType; import com.intellij.psi.util.PsiUtil; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.dsl.toplevel.AnnotatedContextFilter; import org.jetbrains.plugins.groovy.findUsages.LiteralConstructorReference; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap; import org.jetbrains.plugins.groovy.lang.psi.api.signatures.GrSignature; import org.jetbrains.plugins.groovy.lang.psi.impl.GrClosureType; -import org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType; import org.jetbrains.plugins.groovy.lang.psi.impl.GrTupleType; import org.jetbrains.plugins.groovy.lang.psi.impl.signatures.GrClosureSignatureUtil; import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil; @@ -37,28 +34,6 @@ import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrTypeConverter; */ public class GppTypeConverter extends GrTypeConverter { - public static final String GROOVY_LANG_TYPED = "groovy.lang.Typed"; - - public static boolean hasTypedContext(@Nullable PsiElement context) { - if (context == null) { - return false; - } - - if (AnnotatedContextFilter.findContextAnnotation(context, GROOVY_LANG_TYPED) != null) { - return true; - } - - if (isGppExtension(StringUtil.getShortName(context.getContainingFile().getName()))) { - return true; - } - - return false; - } - - public static boolean isGppExtension(String extension) { - return "gpp".equals(extension) || "grunit".equals(extension); - } - @Override public boolean isAllowedInMethodCall() { return true; @@ -84,29 +59,6 @@ public class GppTypeConverter extends GrTypeConverter { } } } - - if (lType instanceof PsiClassType && hasTypedContext(context)) { - return true; - } - } - else if (rType instanceof GrMapType) { - final PsiType lKeyType = PsiUtil.substituteTypeParameter(lType, CommonClassNames.JAVA_UTIL_MAP, 0, false); - final PsiType lValueType = PsiUtil.substituteTypeParameter(lType, CommonClassNames.JAVA_UTIL_MAP, 1, false); - final PsiType[] parameters = ((GrMapType)rType).getParameters(); - if (parameters.length == 2 && lKeyType != null && lValueType != null && - parameters[0] != null && parameters[1] != null && - (!TypesUtil.isAssignable(lKeyType, parameters[0], context) || - !TypesUtil.isAssignable(lValueType, parameters[1], context))) { - return null; - } - - if (hasTypedContext(context)) { - return true; - } - } - else if (rType instanceof GrClosureType && hasTypedContext(context)) { - final PsiType[] methodParameters = GppClosureParameterTypeProvider.findSingleAbstractMethodSignature(lType); - if (isClosureOverride(methodParameters, (GrClosureType)rType, context)) return true; } return null; diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java index 5157c8eddc82..19c39fc531d6 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java @@ -77,7 +77,6 @@ import org.jetbrains.plugins.groovy.findUsages.*; import org.jetbrains.plugins.groovy.geb.*; import org.jetbrains.plugins.groovy.gpp.GppClosureParameterTypeProvider; import org.jetbrains.plugins.groovy.gpp.GppExpectedTypesContributor; -import org.jetbrains.plugins.groovy.gpp.GppImplicitUsageProvider; import org.jetbrains.plugins.groovy.gpp.GppTypeConverter; import org.jetbrains.plugins.groovy.lang.folding.GroovyFoldingBuilder; import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes; @@ -238,7 +237,6 @@ public class GroovyCoreEnvironment { CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitUsageProvider.EP_NAME, ImplicitUsageProvider.class); - appEnvironment.addExtension(ImplicitUsageProvider.EP_NAME, new GppImplicitUsageProvider()); appEnvironment.addExtension(ImplicitUsageProvider.EP_NAME, new GrImplicitUsageProvider()); CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileTypeRegistry.FileTypeDetector.EP_NAME, diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodBaseImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodBaseImpl.java index bcba56016d87..e824bee24916 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodBaseImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodBaseImpl.java @@ -39,7 +39,6 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor; -import org.jetbrains.plugins.groovy.gpp.GppTypeConverter; import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment; import org.jetbrains.plugins.groovy.lang.groovydoc.psi.impl.GrDocCommentUtil; import org.jetbrains.plugins.groovy.lang.lexer.TokenSets; @@ -225,17 +224,12 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase i } } - if (!GppTypeConverter.hasTypedContext(method)) { - LOG.assertTrue(method.isValid(), "invalid method"); - - final GrOpenBlock block = method.getBlock(); - if (block != null) { - LOG.assertTrue(block.isValid(), "invalid code block"); - PsiType inferred = GroovyPsiManager.inferType(method, new MethodTypeInferencer(block)); - if (inferred != null) { - if (nominal == null || nominal.isAssignableFrom(inferred)) { - return inferred; - } + final GrOpenBlock block = method.getBlock(); + if (block != null) { + PsiType inferred = GroovyPsiManager.inferType(method, new MethodTypeInferencer(block)); + if (inferred != null) { + if (nominal == null || nominal.isAssignableFrom(inferred)) { + return inferred; } } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/AutoExternalizeContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/AutoExternalizeContributor.java index 4cfb4da5dec8..d5c6d916af54 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/AutoExternalizeContributor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/AutoExternalizeContributor.java @@ -15,12 +15,9 @@ */ package org.jetbrains.plugins.groovy.lang.resolve.ast; -import com.intellij.psi.CommonClassNames; import com.intellij.psi.PsiMethod; import com.intellij.psi.impl.light.LightMethodBuilder; -import com.intellij.psi.util.InheritanceUtil; import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.groovy.gpp.GppTypeConverter; import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition; import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil; import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames; @@ -54,13 +51,6 @@ public class AutoExternalizeContributor extends AstTransformContributor { } private static boolean hasGeneratedImplementations(GrTypeDefinition clazz) { - if (PsiImplUtil.getAnnotation(clazz, GroovyCommonClassNames.GROOVY_TRANSFORM_AUTO_EXTERNALIZE) != null) { - return true; - } - if (GppTypeConverter.hasTypedContext(clazz)) { - return InheritanceUtil.isInheritor(clazz, CommonClassNames.JAVA_IO_EXTERNALIZABLE) && - clazz.findCodeMethodsByName("readExternal", false).length == 0; - } - return false; + return PsiImplUtil.getAnnotation(clazz, GroovyCommonClassNames.GROOVY_TRANSFORM_AUTO_EXTERNALIZE) != null; } } diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java index 5894a0a5379b..9ba40574a403 100644 --- a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java +++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java @@ -72,7 +72,6 @@ public class GroovyBuilder extends ModuleLevelBuilder { private static final Key> CONTINUATIONS = Key.create("CONTINUATIONS"); private static final Key FILES_MARKED_DIRTY_FOR_NEXT_ROUND = Key.create("SRC_MARKED_DIRTY"); private static final String GROOVY_EXTENSION = "groovy"; - private static final String GPP_EXTENSION = "gpp"; private final boolean myForStubs; private final String myBuilderName; @@ -508,12 +507,12 @@ public class GroovyBuilder extends ModuleLevelBuilder { } public static boolean isGroovyFile(String path) { - return path.endsWith("." + GROOVY_EXTENSION) || path.endsWith("." + GPP_EXTENSION); + return path.endsWith("." + GROOVY_EXTENSION); } @Override public List getCompilableFileExtensions() { - return Arrays.asList(GROOVY_EXTENSION, GPP_EXTENSION); + return Collections.singletonList(GROOVY_EXTENSION); } private static Map buildClassToSourceMap(ModuleChunk chunk, CompileContext context, Set toCompilePaths, Map finalOutputs) throws IOException { diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index 6c2853eb8d08..c8c8a5c5a7cf 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -283,7 +283,6 @@ displayName="Gant"/> - - diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/gpp/GppLibraryPresentationProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/gpp/GppLibraryPresentationProvider.java deleted file mode 100644 index 419736987411..000000000000 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/gpp/GppLibraryPresentationProvider.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2000-2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.plugins.groovy.gpp; - -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.roots.libraries.LibraryKind; -import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.openapi.vfs.VirtualFile; -import icons.JetgroovyIcons; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.config.GroovyLibraryPresentationProviderBase; - -import javax.swing.*; -import java.io.File; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * @author nik - */ -public class GppLibraryPresentationProvider extends GroovyLibraryPresentationProviderBase { - private static final LibraryKind GPP_KIND = LibraryKind.create("gpp"); - private static final Pattern GROOVYPP_JAR = Pattern.compile("groovypp-([\\d\\.]+)\\.jar"); - private static final Pattern GROOVYPP_ALL_JAR = Pattern.compile("groovypp-all-([\\d\\.]+)\\.jar"); - - public GppLibraryPresentationProvider() { - super(GPP_KIND); - } - - @Override - protected void fillLibrary(String path, LibraryEditor libraryEditor) { - File lib = new File(path + "/lib"); - if (lib.exists()) { - libraryEditor.addJarDirectory(VfsUtil.getUrlForLibraryRoot(lib), false, OrderRootType.CLASSES); - } - - File srcRoot = new File(path + "/src"); - addSources(libraryEditor, srcRoot.exists() ? srcRoot : new File(path)); - } - - private static void addSources(LibraryEditor libraryEditor, File srcRoot) { - File compilerSrc = new File(srcRoot, "Compiler/src"); - if (compilerSrc.exists()) { - libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(compilerSrc), OrderRootType.SOURCES); - } - - File stdLibSrc = new File(srcRoot, "StdLib/src"); - if (stdLibSrc.exists()) { - libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(stdLibSrc), OrderRootType.SOURCES); - } - - File mainSrc = new File(srcRoot, "main"); - if (mainSrc.exists()) { - libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(mainSrc), OrderRootType.SOURCES); - } - } - - @Override - public boolean managesLibrary(final VirtualFile[] libraryFiles) { - return getGppVersion(libraryFiles) != null; - } - - @Nls - @Override - public String getLibraryVersion(final VirtualFile[] libraryFiles) { - return getGppVersion(libraryFiles); - } - - @Nullable - private static String getGppVersion(VirtualFile[] files) { - for (VirtualFile file : files) { - Matcher matcher = GROOVYPP_JAR.matcher(file.getName()); - if (matcher.matches()) { - return matcher.group(1); - } - - matcher = GROOVYPP_ALL_JAR.matcher(file.getName()); - if (matcher.matches()) { - return matcher.group(1); - } - } - return null; - } - - @NotNull - @Override - public Icon getIcon() { - return JetgroovyIcons.Groovy.Groovy_16x16; - } - - @NotNull - @Override - public String getSDKVersion(String path) { - final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(path); - assert file != null; - final VirtualFile libDir = file.findChild("lib"); - assert libDir != null; - final String version = getGppVersion(libDir.getChildren()); - if (version != null) { - return version; - } - throw new AssertionError(path); - } - - - @Nls - @NotNull - @Override - public String getLibraryCategoryName() { - return "Groovy++"; - } - - @Override - public boolean managesName(@NotNull String name) { - return super.managesName(name) || StringUtil.startsWithIgnoreCase(name, "groovypp"); - } - - @Override - public boolean isSDKHome(@NotNull VirtualFile file) { - final VirtualFile libDir = file.findChild("lib"); - return libDir != null && getGppVersion(libDir.getChildren()) != null; - } -}