final PsiExpression[] args = list.getExpressions();
final int nonVarargCount = getNonVarargCount(changeInfo, args);
final int varargCount = args.length - nonVarargCount;
+ if (varargCount<0) return;
PsiExpression[] newVarargInitializers = null;
final int newArgsLength;
}
private String getParameterName() {
- return myParameterNameField.getEnteredName();
+ return myParameterNameField.getEnteredName().trim();
}
private int getReplaceFieldsWithGetters() {
@Override
protected void canRun() throws ConfigurationException {
String name = getParameterName();
- if (name == null || !JavaPsiFacade.getInstance(myProject).getNameHelper().isIdentifier(name.trim())) {
+ if (name == null || !JavaPsiFacade.getInstance(myProject).getNameHelper().isIdentifier(name)) {
throw new ConfigurationException("\'" + StringUtil.first(name != null ? name : "", 10 , true) + "\' is invalid parameter name");
}
}
package com.intellij.codeInsight.editorActions.enter;
+import com.intellij.lang.ASTNode;
+import com.intellij.lang.LanguageParserDefinitions;
+import com.intellij.lang.ParserDefinition;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.util.IncorrectOperationException;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.IdeActions;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.LogicalPosition;
-import com.intellij.openapi.editor.ScrollType;
-import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
}
public void executeWriteAction(Editor editor, DataContext dataContext) {
- LogicalPosition caretPosition = editor.getCaretModel().getLogicalPosition();
-
final Document document = editor.getDocument();
+ final RangeMarker rangeMarker =
+ document.createRangeMarker(editor.getCaretModel().getOffset(), editor.getCaretModel().getOffset() );
+ rangeMarker.setGreedyToLeft(false);
+ rangeMarker.setGreedyToRight(false);
final CharSequence chars = document.getCharsSequence();
int offset = editor.getCaretModel().getOffset();
} else {
getEnterHandler().execute(editor, dataContext);
- editor.getCaretModel().moveToLogicalPosition(caretPosition);
+ editor.getCaretModel().moveToOffset(rangeMarker.getStartOffset());
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
}
--- /dev/null
+/*
+ * Copyright 2000-2010 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 standardDsls
+/**
+ * @author Maxim.Medvedev
+ */
+
+def extractTypeParameter(def typeText) {
+ final int start = typeText.indexOf('<')
+ final int end = typeText.lastIndexOf('>')
+
+ if (start < 0) return null
+ if (end < 0) return typeText.substring(start + 1)
+ return typeText.substring(start + 1, end);
+}
+
+def constructTypeArg(def psiType) {
+ def typeText = psiType.canonicalText ?: psiType.presentableText
+ if (!typeText) return ""
+ def arg = extractTypeParameter(typeText)
+ if (!arg) return ""
+ return "<$arg>"
+}
+
+contributor(ctype: "java.util.Collection") {
+ method name: "getAt", params: [arg: "java.lang.Number"], type: extractTypeParameter(psiType.canonicalText ?: psiType.presentableText)
+ method name: "getAt", params: [arg: "groovy.lang.Range"], type: "java.util.List${constructTypeArg(psiType)}"
+ method name: "getAt", params: [arg: "java.util.Collection"], type: "java.util.List${constructTypeArg(psiType)}"
+}
\ No newline at end of file
*/
contributor (ctype:'java.lang.Enum') {
- method name:'values', type:'java.util.Collection', isStatic:true
+ method name: 'values', type: "java.util.Collection<${psiType.canonicalText ?: psiType.presentableText}>", isStatic: true
method name: 'valueOf', type: psiType.canonicalText, params: [name: 'java.lang.String'], isStatic:true
method name: 'next', type: psiType.canonicalText
method name: 'previous', type: psiType.canonicalText
<lang.foldingBuilder language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.folding.GroovyFoldingBuilder"/>
<lang.formatter language="Groovy" implementationClass="org.jetbrains.plugins.groovy.formatter.GroovyFormattingModelBuilder"/>
- <enterHandlerDelegate implementation="org.jetbrains.plugins.groovy.lang.editor.actions.GroovyEnterHandler" order="after EnterBetweenBracesHandler"/>
+ <enterHandlerDelegate implementation="org.jetbrains.plugins.groovy.lang.editor.actions.GroovyEnterHandler"
+ order="before EnterBetweenBracesHandler"/>
<typedHandler implementation="org.jetbrains.plugins.groovy.lang.editor.actions.GStringTypedActionHandler"/>
<backspaceHandlerDelegate implementation="org.jetbrains.plugins.groovy.lang.editor.actions.GStringBackspaceHandlerDelegate"/>
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
+import com.intellij.psi.impl.light.LightElement;
import com.intellij.psi.infos.CandidateInfo;
import com.intellij.psi.search.searches.SuperMethodsSearch;
-import com.intellij.psi.util.InheritanceUtil;
-import com.intellij.psi.util.MethodSignature;
-import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
-import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.HashSet;
}
}
- private static void registerAccessFix(Annotation annotation, GrReferenceExpression place, PsiMember refElement) {
+ private static void registerAccessFix(Annotation annotation, PsiElement place, PsiMember refElement) {
if (refElement instanceof PsiCompiledElement) return;
PsiModifierList modifierList = refElement.getModifierList();
if (modifierList == null) return;
if (parent instanceof GrClosableBlock) {
duplicate = ResolveUtil
.resolveExistingElement((GrClosableBlock)parent, new DuplicateVariablesProcessor(variable), GrVariable.class, GrReferenceExpression.class);
+ if (duplicate instanceof LightElement) {
+ duplicate = null;
+ }
}
}
}
((PsiMethod)constructor).getParameterList().getParametersCount() == 0) {
checkDefaultMapConstructor(myHolder, argList, constructor);
}
+
+ if (!constructorResolveResult.isAccessible()) {
+ String message = GroovyBundle.message("cannot.access", PsiFormatUtil.formatMethod((PsiMethod)constructor, PsiSubstitutor.EMPTY,
+ PsiFormatUtil.SHOW_NAME |
+ PsiFormatUtil.SHOW_TYPE |
+ PsiFormatUtil.TYPE_AFTER |
+ PsiFormatUtil.SHOW_PARAMETERS,
+ PsiFormatUtil.SHOW_TYPE
+ ));
+ final Annotation annotation = myHolder.createWarningAnnotation(getElementToHighlight(refElement), message);
+ registerAccessFix(annotation, refElement, ((PsiMember)constructor));
+ }
+
}
else {
final GroovyResolveResult[] results = newExpression.multiResolveConstructor();
if (PsiTreeUtil.getParentOfType(elementAt, GrImportStatement.class) != null) return;
- if (parameters.length == 1 && CLOSURE_CLASS.equals(parameters[0].getType().getCanonicalText())) {
- document.insertString(offset, " {}");
- caretModel.moveToOffset(offset + 2);
- return;
+ if (parameters.length == 1) {
+ final PsiType type = parameters[0].getType();
+ if (type instanceof PsiClassType) {
+ final PsiClass psiClass = ((PsiClassType)type).resolve();
+ if (psiClass != null && CLOSURE_CLASS.equals(psiClass.getQualifiedName())) {
+ document.insertString(offset, " {}");
+ caretModel.moveToOffset(offset + 2);
+ return;
+ }
+ }
}
PsiDocumentManager docManager = PsiDocumentManager.getInstance(method.getProject());
PsiFile psiFile = docManager.getPsiFile(document);
if (method instanceof GrMethod &&
method.getParameterList().getParametersCount() > 0 &&
- method.getContainingClass() instanceof GroovyScriptClass) {
+ method.getContainingClass() instanceof GroovyScriptClass &&
+ isExpressionStatement(psiFile, context.getStartOffset())) {
return;
}
if (isExpressionStatement(psiFile, context.getStartOffset()) &&
if (element != null &&
element.getNode().getElementType() == mRCURLY &&
element.getParent() instanceof GrClosableBlock &&
- text.length() > caret) {
+ text.length() > caret && afterArrow) {
return Result.DefaultForceIndent;
}
}
String text = node.getText();
String innerText = text.equals("''") ? "" : text.substring(1, text.length() - 1);
TextRange literalRange = stringElement.getTextRange();
- document.replaceString(literalRange.getStartOffset(), literalRange.getEndOffset(), "'''" + innerText + "'''");
+ document.insertString(literalRange.getEndOffset(), "''");
+ document.insertString(literalRange.getStartOffset(), "''");
editor.getCaretModel().moveToOffset(caretOffset + 2);
EditorModificationUtil.insertStringAtCaret(editor, "\n");
}
String text = parent.getText();
String innerText = text.equals("\"\"") ? "" : text.substring(1, text.length() - 1);
TextRange parentRange = parent.getTextRange();
- document.replaceString(parentRange.getStartOffset(), parentRange.getEndOffset(), "\"\"\"" + innerText + "\"\"\"");
+ document.insertString(parentRange.getEndOffset(), "\"\"");
+ document.insertString(parentRange.getStartOffset(), "\"\"");
editor.getCaretModel().moveToOffset(caretOffset + 2);
EditorModificationUtil.insertStringAtCaret(editor, "\n");
if (rightFromDollar) {
import com.intellij.openapi.util.Comparing;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
+import com.intellij.psi.impl.PsiSubstitutorImpl;
import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrClosureSignature;
import org.jetbrains.plugins.groovy.lang.psi.impl.types.GrClosureSignatureUtil;
+import java.util.Map;
+
/**
* @author ven
*/
private final GlobalSearchScope myScope;
private final PsiManager myManager;
private final @NotNull GrClosureSignature mySignature;
+ private final PsiType[] myTypeArgs;
private GrClosureType(LanguageLevel languageLevel, GlobalSearchScope scope, PsiManager manager, @NotNull GrClosureSignature closureSignature) {
super(languageLevel);
myScope = scope;
myManager = manager;
mySignature = closureSignature;
+ final PsiClass psiClass = resolve();
+ if (psiClass!=null && psiClass.getTypeParameters().length==1) {
+ myTypeArgs = new PsiType[]{mySignature.getReturnType()};
+ }
+ else {
+ myTypeArgs = PsiType.EMPTY_ARRAY;
+ }
}
@Nullable
@NotNull
public PsiType[] getParameters() {
- //todo
- return PsiType.EMPTY_ARRAY;
+ return myTypeArgs;
}
@NotNull
public ClassResolveResult resolveGenerics() {
+ final PsiClass closure = resolve();
+ final PsiSubstitutor substitutor;
+ if (closure != null && closure.getTypeParameters().length == 1) {
+ final PsiTypeParameter parameter = closure.getTypeParameters()[0];
+ final Map<PsiTypeParameter, PsiType> map = new HashMap<PsiTypeParameter, PsiType>();
+ map.put(parameter, mySignature.getReturnType());
+ substitutor = PsiSubstitutorImpl.createSubstitutor(map);
+ }
+ else {
+ substitutor = PsiSubstitutor.EMPTY;
+ }
+
return new ClassResolveResult() {
public PsiClass getElement() {
- return resolve();
+ return closure;
}
public PsiSubstitutor getSubstitutor() {
- return PsiSubstitutor.UNKNOWN;
+ return substitutor;
}
public boolean isPackagePrefixPackageReference() {
@NotNull
public String getPresentableText() {
- return "Closure";
+ if (myTypeArgs.length == 0 || myTypeArgs[0] == null) {
+ return "Closure";
+ }
+ else {
+ return "Closure<" + myTypeArgs[0].getPresentableText() + ">";
+ }
}
@Nullable
public String getCanonicalText() {
- return GrClosableBlock.GROOVY_LANG_CLOSURE;
+ if (myTypeArgs.length == 0 || myTypeArgs[0] == null) {
+ return GrClosableBlock.GROOVY_LANG_CLOSURE;
+ }
+ else {
+ return GrClosableBlock.GROOVY_LANG_CLOSURE + "<" + myTypeArgs[0].getCanonicalText() + ">";
+ }
}
@Nullable
public GrMapType(JavaPsiFacade facade,
GlobalSearchScope scope,
Map<String, PsiType> stringEntries,
- List<Pair<PsiType, PsiType>> otherEntries, LanguageLevel languageLevel) {
+ List<Pair<PsiType, PsiType>> otherEntries,
+ LanguageLevel languageLevel) {
super(languageLevel, scope, facade);
myStringEntries = stringEntries;
myOtherEntries = otherEntries;
- myJavaClassName = facade.findClass(JAVA_UTIL_LINKED_HASH_MAP, scope) != null ? JAVA_UTIL_LINKED_HASH_MAP : CommonClassNames.JAVA_UTIL_MAP;
+ myJavaClassName =
+ facade.findClass(JAVA_UTIL_LINKED_HASH_MAP, scope) != null ? JAVA_UTIL_LINKED_HASH_MAP : CommonClassNames.JAVA_UTIL_MAP;
}
@Override
}
public String getClassName() {
- return "Map";
+ return StringUtil.getShortName(myJavaClassName);
}
public PsiType[] getAllKeyTypes() {
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.GrTopStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.packaging.GrPackageDefinition;
+import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightParameter;
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GroovyScriptClass;
import org.jetbrains.plugins.groovy.lang.psi.stubs.GrFileStub;
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
private GrParameter getSyntheticArgsParameter() {
if (mySyntheticArgsParameter == null) {
- final GrParameter candidate =
- GroovyPsiElementFactory.getInstance(getProject()).createParameter(SYNTHETIC_PARAMETER_NAME, "java.lang.String[]", this);
+ final PsiType psiType = JavaPsiFacade.getElementFactory(getProject()).createTypeFromText("java.lang.String[]", this);
+ final GrParameter candidate = new GrLightParameter(SYNTHETIC_PARAMETER_NAME, psiType, this);
synchronized (lock) {
if (mySyntheticArgsParameter == null) {
mySyntheticArgsParameter = candidate;
assert defintion != null && defintion instanceof GrMethod;
return ((GrMethod)defintion);
}
- catch (Error error) {
+ catch (Exception error) {
throw new IncorrectOperationException("Can't create method from text: '" + file.getText() + "'");
}
}
}
public static boolean isInUseScope(GroovyResolveResult resolveResult) {
- final GroovyPsiElement context = resolveResult.getCurrentFileResolveContext();
+ return isInUseScope(resolveResult.getCurrentFileResolveContext());
+ }
+
+ public static boolean isInUseScope(GroovyPsiElement context) {
if (context instanceof GrMethodCall) {
final GrExpression expression = ((GrMethodCall)context).getInvokedExpression();
if (expression instanceof GrReferenceExpression) {
}
return false;
}
+
+ public static boolean isInWithContext(GroovyPsiElement context) {
+ if (context instanceof GrExpression) {
+ final PsiElement parent = context.getParent();
+ if (parent instanceof GrReferenceExpression && ((GrReferenceExpression)parent).getQualifier() == context) {
+ final PsiElement pparent = parent.getParent();
+ if (pparent instanceof GrMethodCall) {
+ final PsiMethod method = ((GrMethodCall)pparent).resolveMethod();
+ if (method instanceof GrGdkMethod && "with".equals(method.getName())) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
}
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.branch.GrReturnStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrAssignmentExpression;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrGdkMethod;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrClosureParameter;
if (method.isConstructor() != myIsConstructor) return true;
if (substitutor == null) substitutor = PsiSubstitutor.EMPTY;
- substitutor = obtainSubstitutor(substitutor, method);
+ substitutor = obtainSubstitutor(substitutor, method, state);
boolean isAccessible = isAccessible(method);
- GroovyPsiElement fileResolveContext = state.get(RESOLVE_CONTEXT);
- boolean isStaticsOK = isStaticsOK(method, fileResolveContext);
- if (!myAllVariants && PsiUtil.isApplicable(myArgumentTypes, method, substitutor, fileResolveContext instanceof GrMethodCallExpression, (GroovyPsiElement)myPlace) && isStaticsOK) {
- addCandidate(new GroovyResolveResultImpl(method, fileResolveContext, substitutor, isAccessible, isStaticsOK));
+ GroovyPsiElement resolveContext = state.get(RESOLVE_CONTEXT);
+ boolean isStaticsOK = isStaticsOK(method, resolveContext);
+ if (!myAllVariants &&
+ PsiUtil.isApplicable(myArgumentTypes, method, substitutor, ResolveUtil.isInUseScope(resolveContext), (GroovyPsiElement)myPlace) &&
+ isStaticsOK) {
+ addCandidate(new GroovyResolveResultImpl(method, resolveContext, substitutor, isAccessible, isStaticsOK));
} else {
- myInapplicableCandidates.add(new GroovyResolveResultImpl(method, fileResolveContext, substitutor, isAccessible, isStaticsOK));
+ myInapplicableCandidates.add(new GroovyResolveResultImpl(method, resolveContext, substitutor, isAccessible, isStaticsOK));
}
return true;
return true;
}
- private PsiSubstitutor obtainSubstitutor(PsiSubstitutor substitutor, PsiMethod method) {
+ private PsiSubstitutor obtainSubstitutor(PsiSubstitutor substitutor, PsiMethod method, ResolveState state) {
final PsiTypeParameter[] typeParameters = method.getTypeParameters();
if (myTypeArguments.length == typeParameters.length) {
for (int i = 0; i < typeParameters.length; i++) {
assert argTypes != null;
//type inference should be performed from static method
PsiType[] newArgTypes = new PsiType[argTypes.length + 1];
- newArgTypes[0] = myThisType;
+ final GroovyPsiElement resolveContext = state.get(RESOLVE_CONTEXT);
+ if (ResolveUtil.isInWithContext(resolveContext)) {
+ newArgTypes[0] = ((GrExpression)resolveContext).getType();
+ }
+ else {
+ newArgTypes[0] = myThisType;
+ }
System.arraycopy(argTypes, 0, newArgTypes, 1, argTypes.length);
argTypes = newArgTypes;
}
}
+ final GrModifierList modifierList = method.getModifierList();
if (changeInfo.isVisibilityChanged()) {
- method.getModifierList().setModifierProperty(changeInfo.getNewVisibility(), true);
+ modifierList.setModifierProperty(changeInfo.getNewVisibility(), true);
}
PsiSubstitutor substitutor = baseMethod != null ? calculateSubstitutor(method, baseMethod) : PsiSubstitutor.EMPTY;
final PsiMethod context = changeInfo.getMethod();
+ GrTypeElement oldReturnTypeElement = method.getReturnTypeElementGroovy();
if (changeInfo.isReturnTypeChanged()) {
CanonicalTypes.Type newReturnType = changeInfo.getNewReturnType();
- GrTypeElement element = method.getReturnTypeElementGroovy();
if (newReturnType == null) {
- if (element != null) {
- element.delete();
- GrModifierList modifierList = method.getModifierList();
+ if (oldReturnTypeElement != null) {
+ oldReturnTypeElement.delete();
if (modifierList.getModifiers().length == 0) {
modifierList.setModifierProperty(GrModifier.DEF, true);
}
PsiType type = newReturnType.getType(context, method.getManager());
final PsiType oldReturnType = method.getReturnType();
if (!TypesUtil
- .isAssignable(type, oldReturnType, context.getManager(), context.getResolveScope())) { //todo ask for replace covariant type
+ .isAssignableByMethodCallConversion(type, oldReturnType, context.getManager(), context.getResolveScope())) { //todo ask for replace covariant type
method.setReturnType(substitutor.substitute(type));
+ if (oldReturnTypeElement==null) {
+ modifierList.setModifierProperty(GrModifier.DEF, false);;
+ }
}
}
}
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel();
final VirtualFile groovyJar =
- JarFileSystem.getInstance().refreshAndFindFileByPath(TestUtils.getMockGroovy1_7LibraryName()+"!/");
+ JarFileSystem.getInstance().refreshAndFindFileByPath(TestUtils.getMockGroovy1_8LibraryName()+"!/");
modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES);
modifiableModel.commit();
}
*/
package org.jetbrains.plugins.groovy.lang.resolve;
-import com.intellij.psi.CommonClassNames;
-import com.intellij.psi.PsiIntersectionType;
-import com.intellij.psi.PsiType;
+import com.intellij.psi.*;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
import org.jetbrains.plugins.groovy.lang.psi.impl.GrClosureType;
import org.jetbrains.plugins.groovy.util.TestUtils;
public void testRawTypeInReturnExpression() {
assertNotNull(resolve("A.groovy"));
}
+
+ private void assertTypeEquals(String expected, String fileName) {
+ final PsiReference ref = configureByFile(getTestName(true) + "/" + fileName);
+ assertInstanceOf(ref, GrReferenceExpression.class);
+ final PsiType type = ((GrReferenceExpression)ref).getType();
+ assertNotNull(type);
+ assertEquals(expected, type.getCanonicalText());
+ }
+
+ public void testTypeOfGroupBy() {
+ assertTypeEquals("java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>>", "A.groovy");
+ }
}
public static final String END_MARKER = "<end>";
public static final String GROOVY_JAR = "groovy-all.jar";
public static final String GROOVY_JAR_17 = "groovy-all-1.7.jar";
+ public static final String GROOVY_JAR_18 = "groovy-1.8.0-beta-2.jar";
public static String getMockJdkHome() {
return getAbsoluteTestDataPath() + "/mockJDK";
return getMockGroovy1_7LibraryHome()+"/groovy-all-1.7.3.jar";
}
+ public static String getMockGroovy1_8LibraryHome() {
+ return getAbsoluteTestDataPath() + "/mockGroovyLib1.8";
+ }
+
+ public static String getMockGroovy1_8LibraryName() {
+ return getMockGroovy1_8LibraryHome()+"/"+GROOVY_JAR_18;
+ }
+
public static PsiFile createPseudoPhysicalGroovyFile(final Project project, final String text) throws IncorrectOperationException {
return createPseudoPhysicalFile(project, TEMP_FILE, text);
}
class Foo {
- def int foo(String s){}
+ int foo(String s){}
}
\ No newline at end of file
--- /dev/null
+[1, 2, 3].with {
+ def by = groupBy({2})
+ print b<ref>y
+}
\ No newline at end of file