mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -39,18 +39,18 @@ public class DFAEngine<E> {
|
||||
}
|
||||
|
||||
|
||||
public List<DFAMap<E>> performDFA() {
|
||||
final ArrayList<DFAMap<E>> info = new ArrayList<DFAMap<E>>(myFlow.length);
|
||||
public List<E> performDFA() {
|
||||
final ArrayList<E> info = new ArrayList<E>(myFlow.length);
|
||||
return performDFA(info);
|
||||
}
|
||||
|
||||
public List<DFAMap<E>> performDFA(final List<DFAMap<E>> info) {
|
||||
public List<E> performDFA(final List<E> info) {
|
||||
if (LOG.isDebugEnabled()){
|
||||
LOG.debug("Perfoming DFA\n" + "Instance: " + myDfa + " Semilattice: " + mySemilattice);
|
||||
}
|
||||
|
||||
// initializing dfa
|
||||
final DFAMap<E> initial = myDfa.initial();
|
||||
final E initial = myDfa.initial();
|
||||
for (int i = 0; i < myFlow.length; i++) {
|
||||
info.add(i, initial);
|
||||
}
|
||||
@@ -104,12 +104,12 @@ public class DFAEngine<E> {
|
||||
}
|
||||
|
||||
final int currentNumber = currentInstruction.num();
|
||||
final DFAMap<E> oldE = info.get(currentNumber);
|
||||
final DFAMap<E> joinedE = join(currentInstruction, info);
|
||||
final DFAMap<E> newE = myDfa.fun(joinedE, currentInstruction);
|
||||
final E oldE = info.get(currentNumber);
|
||||
final E joinedE = join(currentInstruction, info);
|
||||
final E newE = myDfa.fun(joinedE, currentInstruction);
|
||||
if (!mySemilattice.eq(newE, oldE)) {
|
||||
if (LOG.isDebugEnabled()){
|
||||
LOG.debug("Number: " + currentNumber + " old: " + oldE.keySet() + " new: " + newE.keySet());
|
||||
LOG.debug("Number: " + currentNumber + " old: " + oldE.toString() + " new: " + newE.toString());
|
||||
}
|
||||
info.set(currentNumber, newE);
|
||||
for (Instruction next : getNext(currentInstruction)) {
|
||||
@@ -148,9 +148,9 @@ public class DFAEngine<E> {
|
||||
return allPred * 2;
|
||||
}
|
||||
|
||||
private DFAMap<E> join(final Instruction instruction, final List<DFAMap<E>> info) {
|
||||
private E join(final Instruction instruction, final List<E> info) {
|
||||
final Iterable<? extends Instruction> prev = myDfa.isForward() ? instruction.allPred() : instruction.allSucc();
|
||||
final ArrayList<DFAMap<E>> prevInfos = new ArrayList<DFAMap<E>>();
|
||||
final ArrayList<E> prevInfos = new ArrayList<E>();
|
||||
for (Instruction i : prev) {
|
||||
prevInfos.add(info.get(i.num()));
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ public interface DfaInstance<E> {
|
||||
// Please ensure that E has correctly implemented equals method
|
||||
|
||||
// Invariant: fun must create new instance of DFAMap if modifies it
|
||||
DFAMap<E> fun(DFAMap<E> e, Instruction instruction);
|
||||
E fun(E e, Instruction instruction);
|
||||
|
||||
@NotNull
|
||||
DFAMap<E> initial();
|
||||
E initial();
|
||||
|
||||
boolean isForward();
|
||||
}
|
||||
|
||||
@@ -17,9 +17,7 @@ package com.intellij.codeInsight.dataflow;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface Semilattice<E> {
|
||||
// Invariant: join can return unmodified ins(0) or empty DFAMap
|
||||
// DfaInstance must create new one before modifying
|
||||
DFAMap<E> join(ArrayList<DFAMap<E>> ins);
|
||||
E join(ArrayList<E> ins);
|
||||
|
||||
boolean eq(DFAMap<E> e1, DFAMap<E> e2);
|
||||
boolean eq(E e1, E e2);
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package com.intellij.codeInsight.dataflow;
|
||||
package com.intellij.codeInsight.dataflow.map;
|
||||
|
||||
import com.intellij.codeInsight.dataflow.SetUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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 com.intellij.codeInsight.dataflow.map;
|
||||
|
||||
import com.intellij.codeInsight.controlflow.Instruction;
|
||||
import com.intellij.codeInsight.dataflow.DFAEngine;
|
||||
|
||||
public class DFAMapEngine<E> extends DFAEngine<DFAMap<E>>{
|
||||
public DFAMapEngine(final Instruction[] flow, final DfaMapInstance<E> dfa, final MapSemilattice<E> dfaMapSemilattice) {
|
||||
super(flow, dfa, dfaMapSemilattice);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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 com.intellij.codeInsight.dataflow.map;
|
||||
|
||||
import com.intellij.codeInsight.dataflow.DfaInstance;
|
||||
|
||||
public interface DfaMapInstance<E> extends DfaInstance<DFAMap<E>> {
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2000-2007 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 com.intellij.codeInsight.dataflow.map;
|
||||
|
||||
import com.intellij.codeInsight.dataflow.Semilattice;
|
||||
|
||||
public interface MapSemilattice<E> extends Semilattice<DFAMap<E>>{
|
||||
// Invariant: join can return unmodified ins(0) or empty DFAMap
|
||||
// DfaInstance must create new one before modifying
|
||||
}
|
||||
+28
-23
@@ -36,6 +36,7 @@ import com.intellij.openapi.ui.popup.*;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.ui.awt.RelativeRectangle;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -717,37 +718,41 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
|
||||
public void updateActionsImmediately() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
myNewVisibleActions.clear();
|
||||
final DataContext dataContext = getDataContext();
|
||||
IdeFocusManager.getInstance(null).doWhenFocusSettlesDown(new Runnable() {
|
||||
public void run() {
|
||||
myNewVisibleActions.clear();
|
||||
final DataContext dataContext = getDataContext();
|
||||
|
||||
Utils.expandActionGroup(myActionGroup, myNewVisibleActions, myPresentationFactory, dataContext, myPlace, myActionManager);
|
||||
Utils.expandActionGroup(myActionGroup, myNewVisibleActions, myPresentationFactory, dataContext, myPlace, myActionManager);
|
||||
|
||||
if (!myNewVisibleActions.equals(myVisibleActions)) {
|
||||
// should rebuild UI
|
||||
if (!myNewVisibleActions.equals(myVisibleActions)) {
|
||||
// should rebuild UI
|
||||
|
||||
final boolean changeBarVisibility = myNewVisibleActions.isEmpty() || myVisibleActions.isEmpty();
|
||||
final boolean changeBarVisibility = myNewVisibleActions.isEmpty() || myVisibleActions.isEmpty();
|
||||
|
||||
final ArrayList<AnAction> temp = myVisibleActions;
|
||||
myVisibleActions = myNewVisibleActions;
|
||||
myNewVisibleActions = temp;
|
||||
final ArrayList<AnAction> temp = myVisibleActions;
|
||||
myVisibleActions = myNewVisibleActions;
|
||||
myNewVisibleActions = temp;
|
||||
|
||||
removeAll();
|
||||
mySecondaryActions.removeAll();
|
||||
mySecondaryActionsButton = null;
|
||||
fillToolBar(myVisibleActions, getLayoutPolicy() == AUTO_LAYOUT_POLICY && myOrientation == SwingConstants.HORIZONTAL);
|
||||
removeAll();
|
||||
mySecondaryActions.removeAll();
|
||||
mySecondaryActionsButton = null;
|
||||
fillToolBar(myVisibleActions, getLayoutPolicy() == AUTO_LAYOUT_POLICY && myOrientation == SwingConstants.HORIZONTAL);
|
||||
|
||||
if (changeBarVisibility) {
|
||||
revalidate();
|
||||
}
|
||||
else {
|
||||
final Container parent = getParent();
|
||||
if (parent != null) {
|
||||
parent.invalidate();
|
||||
parent.validate();
|
||||
if (changeBarVisibility) {
|
||||
revalidate();
|
||||
}
|
||||
else {
|
||||
final Container parent = getParent();
|
||||
if (parent != null) {
|
||||
parent.invalidate();
|
||||
parent.validate();
|
||||
}
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setTargetComponent(final JComponent component) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -365,31 +366,28 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
|
||||
@Override
|
||||
public void visitListOrMap(GrListOrMap listOrMap) {
|
||||
final Map<GrNamedArgument, List<GrNamedArgument>> map = DuplicatesUtil.factorDuplicates(listOrMap.getNamedArguments(), new TObjectHashingStrategy<GrNamedArgument>() {
|
||||
public int computeHashCode(GrNamedArgument arg) {
|
||||
final GrArgumentLabel label = arg.getLabel();
|
||||
if (label == null) return 0;
|
||||
MultiMap<String, GrNamedArgument> map = new MultiMap<String, GrNamedArgument>();
|
||||
|
||||
for (GrNamedArgument element : listOrMap.getNamedArguments()) {
|
||||
final GrArgumentLabel label = element.getLabel();
|
||||
if (label != null) {
|
||||
final String name = label.getName();
|
||||
if (name == null) return 0;
|
||||
return name.hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(GrNamedArgument arg1, GrNamedArgument arg2) {
|
||||
final GrArgumentLabel label1 = arg1.getLabel();
|
||||
final GrArgumentLabel label2 = arg2.getLabel();
|
||||
if (label1 == null || label2 == null) {
|
||||
return label1 == null && label2 == null;
|
||||
if (name != null) {
|
||||
map.putValue(name, element);
|
||||
}
|
||||
final String name1 = label1.getName();
|
||||
final String name2 = label2.getName();
|
||||
if (name1 == null || name2 == null) {
|
||||
return name1 == null && name2 == null;
|
||||
}
|
||||
return name1.equals(name2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
processDuplicates(map, myHolder);
|
||||
for (String key : map.keySet()) {
|
||||
final Collection<GrNamedArgument> arguments = map.get(key);
|
||||
if (arguments.size() > 1) {
|
||||
final List<GrNamedArgument> args = new ArrayList<GrNamedArgument>(arguments);
|
||||
for (int i = 1; i < args.size(); i++) {
|
||||
GrNamedArgument namedArgument = args.get(i);
|
||||
myHolder.createWarningAnnotation(namedArgument.getLabel(), GroovyBundle.message("duplicate.element.in.the.map"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -734,15 +732,6 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
|
||||
}
|
||||
}
|
||||
|
||||
protected static void processDuplicates(Map<GrNamedArgument, List<GrNamedArgument>> map, AnnotationHolder holder) {
|
||||
for (List<GrNamedArgument> args : map.values()) {
|
||||
for (int i = 1; i < args.size(); i++) {
|
||||
GrNamedArgument namedArgument = args.get(i);
|
||||
holder.createWarningAnnotation(namedArgument, GroovyBundle.message("duplicate.element.in.the.map"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerAbstractMethodFix(Annotation annotation, GrMethod method, boolean makeClassAbstract) {
|
||||
if (method.getBlock() == null) {
|
||||
annotation.registerFix(new AddMethodBodyFix(method));
|
||||
|
||||
@@ -224,6 +224,8 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testSuperConstructorInvocation() throws Exception {doTest();}
|
||||
|
||||
public void testDuplicateMapKeys() throws Exception {doTest();}
|
||||
|
||||
public void testIndexPropertyAccess() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
x = [ (person.firstNameKey):person.firstName, (person.lastNameKey):person.lastName ]
|
||||
x = [2:1, <warning descr="Duplicate element in the map">2</warning>:2]
|
||||
+2
-3
@@ -107,14 +107,13 @@ public class MavenModuleImporter {
|
||||
|
||||
private void configDependencies() {
|
||||
for (MavenArtifact artifact : myMavenProject.getDependencies()) {
|
||||
boolean isExportable = artifact.isExportable();
|
||||
DependencyScope scope = selectScope(artifact.getScope());
|
||||
MavenProject depProject = myMavenTree.findProject(artifact.getMavenId());
|
||||
if (depProject != null) {
|
||||
myRootModelAdapter.addModuleDependency(myMavenProjectToModuleName.get(depProject), isExportable, scope);
|
||||
myRootModelAdapter.addModuleDependency(myMavenProjectToModuleName.get(depProject), scope);
|
||||
}
|
||||
else if (myMavenProject.isSupportedDependency(artifact)) {
|
||||
myRootModelAdapter.addLibraryDependency(artifact, isExportable, scope, myModifiableModelsProvider, myMavenProject);
|
||||
myRootModelAdapter.addLibraryDependency(artifact, scope, myModifiableModelsProvider, myMavenProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -194,7 +194,7 @@ public class MavenRootModelAdapter {
|
||||
return new Path(path);
|
||||
}
|
||||
|
||||
public void addModuleDependency(String moduleName, boolean isExportable, DependencyScope scope) {
|
||||
public void addModuleDependency(String moduleName, DependencyScope scope) {
|
||||
Module m = findModuleByName(moduleName);
|
||||
|
||||
ModuleOrderEntry e;
|
||||
@@ -205,7 +205,6 @@ public class MavenRootModelAdapter {
|
||||
e = myRootModel.addInvalidModuleEntry(moduleName);
|
||||
}
|
||||
|
||||
e.setExported(isExportable);
|
||||
e.setScope(scope);
|
||||
}
|
||||
|
||||
@@ -215,7 +214,6 @@ public class MavenRootModelAdapter {
|
||||
}
|
||||
|
||||
public void addLibraryDependency(MavenArtifact artifact,
|
||||
boolean isExportable,
|
||||
DependencyScope scope,
|
||||
MavenModifiableModelsProvider provider,
|
||||
MavenProject project) {
|
||||
@@ -234,7 +232,6 @@ public class MavenRootModelAdapter {
|
||||
}
|
||||
|
||||
LibraryOrderEntry e = myRootModel.addLibraryEntry(library);
|
||||
e.setExported(isExportable);
|
||||
e.setScope(scope);
|
||||
}
|
||||
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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 org.jetbrains.idea.maven.project.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import org.jetbrains.idea.maven.utils.actions.MavenActionUtil;
|
||||
|
||||
public class DownloadActionGroup extends DefaultActionGroup {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
e.getPresentation().setEnabled(MavenActionUtil.getProjectsManager(e.getDataContext()).isMavenizedProject());
|
||||
}
|
||||
}
|
||||
+5
@@ -26,5 +26,10 @@ public abstract class MavenProjectsManagerAction extends MavenAction {
|
||||
perform(MavenActionUtil.getProjectsManager(e.getDataContext()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAvailable(AnActionEvent e) {
|
||||
return super.isAvailable(e) && MavenActionUtil.getProjectsManager(e.getDataContext()).isMavenizedProject();
|
||||
}
|
||||
|
||||
protected abstract void perform(MavenProjectsManager manager);
|
||||
}
|
||||
|
||||
+6
@@ -15,9 +15,15 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.project.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager;
|
||||
|
||||
public class ReimportAction extends MavenProjectsManagerAction {
|
||||
@Override
|
||||
protected boolean isAvailable(AnActionEvent e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void perform(MavenProjectsManager manager) {
|
||||
manager.forceUpdateAllProjectsOrFindAllAvailablePomFiles();
|
||||
|
||||
+1
-3
@@ -29,8 +29,6 @@ public class MavenActionGroup extends DefaultActionGroup {
|
||||
}
|
||||
|
||||
protected boolean isAvailable(AnActionEvent e) {
|
||||
final DataContext context = e.getDataContext();
|
||||
if (MavenActionUtil.getProject(context) == null) return false;
|
||||
return !MavenActionUtil.getMavenProjects(context).isEmpty();
|
||||
return !MavenActionUtil.getMavenProjects(e.getDataContext()).isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.project.MavenProject;
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager;
|
||||
@@ -33,7 +34,7 @@ public class MavenActionUtil {
|
||||
private MavenActionUtil() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public static Project getProject(DataContext context) {
|
||||
return PlatformDataKeys.PROJECT.getData(context);
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public abstract class MavenToggleAction extends ToggleAction implements DumbAwar
|
||||
}
|
||||
|
||||
protected boolean isAvailable(AnActionEvent e) {
|
||||
return MavenActionUtil.getProject(e.getDataContext()) != null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean isSelected(AnActionEvent e) {
|
||||
|
||||
@@ -293,7 +293,8 @@
|
||||
</action>
|
||||
</group>
|
||||
|
||||
<group id="Maven.DownloadAllGroup" popup="true" icon="/images/download.png">
|
||||
<group id="Maven.DownloadAllGroup" popup="true" class="org.jetbrains.idea.maven.project.actions.DownloadActionGroup"
|
||||
icon="/images/download.png">
|
||||
<reference id="Maven.DownloadAllSources"/>
|
||||
<reference id="Maven.DownloadAllDocs"/>
|
||||
<reference id="Maven.DownloadAllSourcesAndDocs"/>
|
||||
|
||||
@@ -199,7 +199,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
|
||||
assertModuleDeps(moduleName, LibraryOrderEntry.class, expectedDeps);
|
||||
}
|
||||
|
||||
protected void assertExportedModuleDeps(String moduleName, String... expectedDeps) {
|
||||
protected void assertExportedDeps(String moduleName, String... expectedDeps) {
|
||||
final List<String> actual = new ArrayList<String>();
|
||||
|
||||
getRootManager(moduleName).processOrder(new RootPolicy<Object>() {
|
||||
|
||||
+6
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.compiler;
|
||||
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerManagerImpl;
|
||||
import com.intellij.compiler.CompilerWorkspaceConfiguration;
|
||||
import com.intellij.compiler.impl.ModuleCompileScope;
|
||||
import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -824,6 +827,9 @@ public class ResourceFilteringTest extends MavenImportingTestCase {
|
||||
}
|
||||
|
||||
public void testDoNotFilterButCopyBigFiles() throws Exception {
|
||||
assertFalse(CompilerConfiguration.getInstance(myProject).isResourceFile("file.xyz"));
|
||||
assertEquals(FileTypeManager.getInstance().getFileTypeByFileName("file.xyz"), StdFileTypes.UNKNOWN);
|
||||
|
||||
createProjectSubFile("resources/file.xyz").setBinaryContent(new byte[1024 * 1024 * 20]);
|
||||
|
||||
importProject("<groupId>test</groupId>" +
|
||||
|
||||
+4
-76
@@ -21,7 +21,6 @@ import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.idea.maven.MavenImportingTestCase;
|
||||
@@ -527,30 +526,7 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
|
||||
assertModuleModuleDepScope("m1", "m4", DependencyScope.TEST);
|
||||
}
|
||||
|
||||
public void testOptionalLibraryDependencyIsNotExportable() throws Exception {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<dependencies>" +
|
||||
" <dependency>" +
|
||||
" <groupId>group</groupId>" +
|
||||
" <artifactId>lib1</artifactId>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>group</groupId>" +
|
||||
" <artifactId>lib2</artifactId>" +
|
||||
" <version>1</version>" +
|
||||
" <optional>true</optional>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
assertModules("project");
|
||||
assertExportedModuleDeps("project", "Maven: group:lib1:1");
|
||||
}
|
||||
|
||||
public void testOptionalModuleDependencyIsNotExportable() throws Exception {
|
||||
public void testDependenciesAreNotExported() throws Exception {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<packaging>pom</packaging>" +
|
||||
@@ -572,10 +548,9 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>m3</artifactId>" +
|
||||
" <groupId>lib</groupId>" +
|
||||
" <artifactId>lib</artifactId>" +
|
||||
" <version>1</version>" +
|
||||
" <optional>true</optional>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
@@ -583,55 +558,8 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
|
||||
"<artifactId>m2</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
createModulePom("m3", "<groupId>test</groupId>" +
|
||||
"<artifactId>m3</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
importProject();
|
||||
|
||||
assertExportedModuleDeps("m1", "m2");
|
||||
}
|
||||
|
||||
public void testOnlyCompileAndRuntimeDependenciesAreExported() throws Exception {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<dependencies>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>compile</artifactId>" +
|
||||
" <scope>compile</scope>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>runtime</artifactId>" +
|
||||
" <scope>runtime</scope>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>test</artifactId>" +
|
||||
" <scope>test</scope>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>provided</artifactId>" +
|
||||
" <scope>provided</scope>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>system</artifactId>" +
|
||||
" <scope>system</scope>" +
|
||||
" <systemPath>${java.home}/lib/tools.jar</systemPath>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
assertExportedModuleDeps("project", "Maven: test:compile:1", "Maven: test:runtime:1");
|
||||
assertExportedDeps("m1");
|
||||
}
|
||||
|
||||
public void testTransitiveDependencies() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user