From 72ad69db1f9826be96609f0f8077cfa7e7959c22 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 17 Apr 2012 11:59:29 +0200 Subject: [PATCH 01/44] use "" marker in inspection description to exclude part of the text in the tooltip "More..." popup --- .../impl/DaemonTooltipRendererProvider.java | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipRendererProvider.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipRendererProvider.java index 822e68e24e21..370963eec023 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipRendererProvider.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipRendererProvider.java @@ -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. @@ -133,28 +133,34 @@ public class DaemonTooltipRendererProvider implements ErrorStripTooltipRendererP @Override protected boolean dressDescription(@NotNull final Editor editor) { - final String[] problems = UIUtil.getHtmlBody(myText).split(BORDER_LINE); + final List problems = StringUtil.split(UIUtil.getHtmlBody(myText), BORDER_LINE); String text = ""; for (String problem : problems) { final String ref = getLinkRef(problem); if (ref != null) { String description = TooltipLinkHandlerEP.getDescription(ref, editor); if (description != null) { - final Pattern pattern = Pattern.compile(".*Use.*(the (panel|checkbox|checkboxes|field|button|controls).*below).*", Pattern.DOTALL); - final Matcher matcher = pattern.matcher(description); - int startFindIdx = 0; - while (matcher.find(startFindIdx)) { - final int end = matcher.end(1); - startFindIdx = end; - description = description.substring(0, matcher.start(1)) + " inspection settings " + description.substring(end); + description = UIUtil.getHtmlBody(description); + final int descriptionEnd = description.indexOf(""); + if (descriptionEnd < 0) { + final Pattern pattern = Pattern.compile(".*Use.*(the (panel|checkbox|checkboxes|field|button|controls).*below).*", Pattern.DOTALL); + final Matcher matcher = pattern.matcher(description); + int startFindIdx = 0; + while (matcher.find(startFindIdx)) { + final int end = matcher.end(1); + startFindIdx = end; + description = description.substring(0, matcher.start(1)) + " inspection settings " + description.substring(end); + } + } else { + description = description.substring(0, descriptionEnd); } text += UIUtil.getHtmlBody(problem).replace(DaemonBundle.message("inspection.extended.description"), DaemonBundle.message("inspection.collapse.description")) + - BORDER_LINE + UIUtil.getHtmlBody(description) + BORDER_LINE; + BORDER_LINE + description + BORDER_LINE; } } } - if (text.length() > 0) { //otherwise do not change anything + if (!text.isEmpty()) { //otherwise do not change anything myText = "" + StringUtil.trimEnd(text, BORDER_LINE) + ""; return true; } From 0d9e6056f0f7a7878ca4779cd36c7d0aa9c88840 Mon Sep 17 00:00:00 2001 From: Alexey Gopachenko Date: Tue, 17 Apr 2012 11:56:20 +0200 Subject: [PATCH 02/44] LINUX softer wording on OpenJDK warning --- bin/scripts/unix/idea.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/scripts/unix/idea.sh b/bin/scripts/unix/idea.sh index 1b436d488e97..b818b17e501b 100755 --- a/bin/scripts/unix/idea.sh +++ b/bin/scripts/unix/idea.sh @@ -86,13 +86,17 @@ BITS=$? if [ $OPEN_JDK -eq 0 ]; then echo "WARNING: You are launching the IDE using OpenJDK Java runtime." echo - echo " THIS IS STRICTLY UNSUPPORTED DUE TO KNOWN PERFORMANCE AND GRAPHICS PROBLEMS!" + echo " ITS KNOWN TO HAVE PERFORMANCE AND GRAPHICS ISSUES!" + echo " SWITCH TO THE ORACLE(SUN) JDK BEFORE REPORTING PROBLEMS!" echo echo "NOTE: If you have both Oracle (Sun) JDK and OpenJDK installed" echo " please validate either @@product_uc@@_JDK, JDK_HOME, or JAVA_HOME environment variable points to valid Oracle (Sun) JDK installation." echo " See http://ow.ly/6TuKQ for more info on switching default JDK." echo echo "Press Enter to continue." +# --------------------------------------------------------------------- +# COMMENT LINE BELOW TO REMOVE PAUSE AFTER OPEN JDK WARNING +# --------------------------------------------------------------------- read IGNORE fi if [ $BITS -eq 0 ]; then From 1d1fb31a07595ca6604f709a1d10b6b0ad4dae75 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 17 Apr 2012 12:05:50 +0200 Subject: [PATCH 03/44] IDEA-84491 (False positive "Utility class without private constructor" for Spring @Configuration class with static @Bean methods) --- .../classlayout/UtilityClassInspection.java | 35 ++++++++- ...ssWithoutPrivateConstructorInspection.java | 77 ++++++++++--------- .../AddToIgnoreIfAnnotatedByListQuickFix.java | 56 ++++++++++++++ .../inspectionDescriptions/UtilityClass.html | 3 + ...UtilityClassWithoutPrivateConstructor.html | 5 ++ 5 files changed, 138 insertions(+), 38 deletions(-) create mode 100644 plugins/InspectionGadgets/src/com/siyeh/ig/fixes/AddToIgnoreIfAnnotatedByListQuickFix.java diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassInspection.java index 3d9a3902ed01..3bfe6cd9aea3 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2012 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,57 @@ */ package com.siyeh.ig.classlayout; +import com.intellij.codeInsight.AnnotationUtil; +import com.intellij.codeInspection.util.SpecialAnnotationsUtil; import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiModifierListOwner; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; +import com.siyeh.ig.InspectionGadgetsFix; +import com.siyeh.ig.fixes.AddToIgnoreIfAnnotatedByListQuickFix; import com.siyeh.ig.psiutils.UtilityClassUtil; +import com.siyeh.ig.ui.ExternalizableStringSet; import org.jetbrains.annotations.NotNull; +import javax.swing.*; + public class UtilityClassInspection extends BaseInspection { + @SuppressWarnings({"PublicField"}) + public final ExternalizableStringSet ignorableAnnotations = new ExternalizableStringSet(); + + @Override @NotNull public String getDisplayName() { return InspectionGadgetsBundle.message("utility.class.display.name"); } + @Override @NotNull protected String buildErrorString(Object... infos) { return InspectionGadgetsBundle.message( "utility.class.problem.descriptor"); } + @NotNull + @Override + protected InspectionGadgetsFix[] buildFixes(Object... infos) { + return AddToIgnoreIfAnnotatedByListQuickFix.build((PsiModifierListOwner) infos[0], ignorableAnnotations); + } + + @Override + public JComponent createOptionsPanel() { + return SpecialAnnotationsUtil.createSpecialAnnotationsListControl( + ignorableAnnotations, InspectionGadgetsBundle.message("ignore.if.annotated.by")); + } + + @Override public BaseInspectionVisitor buildVisitor() { return new UtilityClassVisitor(); } - private static class UtilityClassVisitor extends BaseInspectionVisitor { + private class UtilityClassVisitor extends BaseInspectionVisitor { @Override public void visitClass(@NotNull PsiClass aClass) { @@ -47,7 +73,10 @@ public class UtilityClassInspection extends BaseInspection { if (!UtilityClassUtil.isUtilityClass(aClass)) { return; } - registerClassError(aClass); + if (AnnotationUtil.isAnnotated(aClass, ignorableAnnotations)) { + return; + } + registerClassError(aClass, aClass); } } } \ No newline at end of file diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassWithoutPrivateConstructorInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassWithoutPrivateConstructorInspection.java index 84801a054748..722fc10ce773 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassWithoutPrivateConstructorInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassWithoutPrivateConstructorInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2012 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,9 @@ */ package com.siyeh.ig.classlayout; +import com.intellij.codeInsight.AnnotationUtil; import com.intellij.codeInspection.ProblemDescriptor; -import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel; +import com.intellij.codeInspection.util.SpecialAnnotationsUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.psi.*; @@ -27,25 +28,32 @@ import com.intellij.psi.search.searches.ClassInheritorsSearch; import com.intellij.psi.search.searches.ReferencesSearch; import com.intellij.util.IncorrectOperationException; import com.intellij.util.Query; +import com.intellij.util.ui.CheckBox; import com.siyeh.HardcodedMethodConstants; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; import com.siyeh.ig.InspectionGadgetsFix; +import com.siyeh.ig.fixes.AddToIgnoreIfAnnotatedByListQuickFix; import com.siyeh.ig.psiutils.UtilityClassUtil; +import com.siyeh.ig.ui.ExternalizableStringSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; public class UtilityClassWithoutPrivateConstructorInspection extends BaseInspection { - /** - * @noinspection PublicField for externalization - */ + @SuppressWarnings({"PublicField"}) public boolean ignoreClassesWithOnlyMain = false; + @SuppressWarnings({"PublicField"}) + public final ExternalizableStringSet ignorableAnnotations = new ExternalizableStringSet(); + @Override @NotNull public String getDisplayName() { @@ -63,30 +71,34 @@ public class UtilityClassWithoutPrivateConstructorInspection @Override @Nullable public JComponent createOptionsPanel() { - return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message( - "utility.class.without.private.constructor.option"), this, - "ignoreClassesWithOnlyMain"); + final JPanel panel = new JPanel(new BorderLayout()); + final JPanel annotationsPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl( + ignorableAnnotations, InspectionGadgetsBundle.message("ignore.if.annotated.by")); + panel.add(annotationsPanel, BorderLayout.CENTER); + final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message("utility.class.without.private.constructor.option"), + this, "ignoreClassesWithOnlyMain"); + panel.add(checkBox, BorderLayout.SOUTH); + return panel; } + @NotNull @Override - protected InspectionGadgetsFix buildFix(Object... infos) { + protected InspectionGadgetsFix[] buildFixes(Object... infos) { + final List fixes = new ArrayList(); final PsiClass aClass = (PsiClass)infos[0]; final PsiMethod constructor = getNullArgConstructor(aClass); if (constructor == null) { - return new CreateEmptyPrivateConstructor(); + fixes.add(new CreateEmptyPrivateConstructor()); } else { - final Query query = - ReferencesSearch.search(constructor, - constructor.getUseScope()); + final Query query = ReferencesSearch.search(constructor, constructor.getUseScope()); final PsiReference reference = query.findFirst(); if (reference == null) { - return new MakeConstructorPrivateFix(); - } - else { - return null; + fixes.add(new MakeConstructorPrivateFix()); } } + AddToIgnoreIfAnnotatedByListQuickFix.build(aClass, ignorableAnnotations, fixes); + return fixes.toArray(new InspectionGadgetsFix[fixes.size()]); } private static class CreateEmptyPrivateConstructor @@ -131,14 +143,12 @@ public class UtilityClassWithoutPrivateConstructorInspection final PsiModifierList modifierList = constructor.getModifierList(); modifierList.setModifierProperty(PsiModifier.PRIVATE, true); aClass.add(constructor); - final CodeStyleManager styleManager = - CodeStyleManager.getInstance(project); + final CodeStyleManager styleManager = CodeStyleManager.getInstance(project); styleManager.reformat(constructor); } } - private static class MakeConstructorPrivateFix - extends InspectionGadgetsFix { + private static class MakeConstructorPrivateFix extends InspectionGadgetsFix { @NotNull public String getName() { @@ -154,13 +164,11 @@ public class UtilityClassWithoutPrivateConstructorInspection if (aClass == null) { return; } - final PsiMethod[] constructurs = aClass.getConstructors(); - for (final PsiMethod constructor : constructurs) { - final PsiParameterList parameterList = - constructor.getParameterList(); + final PsiMethod[] constructors = aClass.getConstructors(); + for (final PsiMethod constructor : constructors) { + final PsiParameterList parameterList = constructor.getParameterList(); if (parameterList.getParametersCount() == 0) { - final PsiModifierList modifiers = - constructor.getModifierList(); + final PsiModifierList modifiers = constructor.getModifierList(); modifiers.setModifierProperty(PsiModifier.PUBLIC, false); modifiers.setModifierProperty(PsiModifier.PROTECTED, false); modifiers.setModifierProperty(PsiModifier.PRIVATE, true); @@ -174,8 +182,7 @@ public class UtilityClassWithoutPrivateConstructorInspection return new UtilityClassWithoutPrivateConstructorVisitor(); } - private class UtilityClassWithoutPrivateConstructorVisitor - extends BaseInspectionVisitor { + private class UtilityClassWithoutPrivateConstructorVisitor extends BaseInspectionVisitor { @Override public void visitClass(@NotNull PsiClass aClass) { @@ -192,10 +199,11 @@ public class UtilityClassWithoutPrivateConstructorInspection if (hasPrivateConstructor(aClass)) { return; } - final SearchScope scope = - GlobalSearchScope.projectScope(aClass.getProject()); - final Query query = - ClassInheritorsSearch.search(aClass, scope, true, true); + if (AnnotationUtil.isAnnotated(aClass, ignorableAnnotations)) { + return; + } + final SearchScope scope = GlobalSearchScope.projectScope(aClass.getProject()); + final Query query = ClassInheritorsSearch.search(aClass, scope, true, true); final PsiClass subclass = query.findFirst(); if (subclass != null) { return; @@ -229,8 +237,7 @@ public class UtilityClassWithoutPrivateConstructorInspection if (!PsiType.VOID.equals(returnType)) { return false; } - final PsiParameterList parameterList = - method.getParameterList(); + final PsiParameterList parameterList = method.getParameterList(); if (parameterList.getParametersCount() != 1) { return false; } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/AddToIgnoreIfAnnotatedByListQuickFix.java b/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/AddToIgnoreIfAnnotatedByListQuickFix.java new file mode 100644 index 000000000000..594f6f23b42a --- /dev/null +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/AddToIgnoreIfAnnotatedByListQuickFix.java @@ -0,0 +1,56 @@ +/* + * 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. + * 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.siyeh.ig.fixes; + +import com.intellij.codeInsight.daemon.QuickFixBundle; +import com.intellij.codeInspection.util.SpecialAnnotationsUtil; +import com.intellij.psi.PsiModifierListOwner; +import com.intellij.util.Processor; +import com.siyeh.ig.DelegatingFix; +import com.siyeh.ig.InspectionGadgetsFix; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Bas Leijdekkers + */ +public class AddToIgnoreIfAnnotatedByListQuickFix { + + private AddToIgnoreIfAnnotatedByListQuickFix() {} + + + public static InspectionGadgetsFix[] build(PsiModifierListOwner modifierListOwner, List configurationList) { + final List fixes = build(modifierListOwner, configurationList, new ArrayList()); + return fixes.isEmpty() ? InspectionGadgetsFix.EMPTY_ARRAY : fixes.toArray(new InspectionGadgetsFix[fixes.size()]); + } + + public static List build(final PsiModifierListOwner modifierListOwner, + final List configurationList, + final List fixes) { + SpecialAnnotationsUtil.createAddToSpecialAnnotationFixes(modifierListOwner, new Processor() { + @Override + public boolean process(String qualifiedName) { + fixes.add(new DelegatingFix(SpecialAnnotationsUtil.createAddToSpecialAnnotationsListQuickFix( + "Add '" + qualifiedName + "' to 'ignore if annotated by' list", // add '@asdf' to 'ignore if annotated by' list + QuickFixBundle.message("fix.add.special.annotation.family"), + configurationList, qualifiedName, modifierListOwner))); + return true; + } + }); + return fixes; + } +} diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClass.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClass.html index 3ef56b615e82..60c176c7dc68 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClass.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClass.html @@ -3,6 +3,9 @@ This inspection reports utility classes. Utility classes have all fields and methods declared static, and their presence may indicate a lack of object-oriented design. + +

+Use the list below to ignore classes which are annotated by the annotations added to the list.

Powered by InspectionGadgets diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClassWithoutPrivateConstructor.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClassWithoutPrivateConstructor.html index 30544809801f..802af705f5f1 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClassWithoutPrivateConstructor.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClassWithoutPrivateConstructor.html @@ -3,6 +3,11 @@ This inspection reports utility classes which do not have private constructors. Utility classes have all fields and methods declared static. Giving such classes a private constructor prevents them from being inadvertently instantiated. + +

+Use the list below to ignore classes which are annotated by the annotations added to the list. +

+Use the checkbox below to ignore classes which only have a main method and no other methods.

Powered by InspectionGadgets From 7a17222ff68ce0a31b05047e6d1303b0819cdb2e Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 17 Apr 2012 11:38:11 +0200 Subject: [PATCH 04/44] test data for (IDEA-70468) --- .../UncheckedWarningsLevel6.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/UncheckedWarningsLevel6.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/UncheckedWarningsLevel6.java index ad6d8e79d114..2765ed42befa 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/UncheckedWarningsLevel6.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/UncheckedWarningsLevel6.java @@ -1,3 +1,4 @@ +import java.lang.Override; import java.util.*; class GenericsTest { @@ -91,4 +92,30 @@ class GenericsTest2 { } }; } +} +class Example { + private static void assertThat(T actual, Matcher matcher) { + assert actual != null; + assert matcher != null; + } + + private static Matcher> hasSize(int size) { + assert size >=0; + return new Matcher>() { + @Override + public void foo(Collection es) { + System.out.println(es); + } + }; + } + + public static void main(String[] args) { + List list = new ArrayList(); + System.out.println(list); + assertThat(new ArrayList(), hasSize(0)); + } + + private interface Matcher { + void foo(T t); + } } \ No newline at end of file From ca8c474bf621e26fdfa02682fb1ce7b0636dd644 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 17 Apr 2012 12:08:52 +0200 Subject: [PATCH 05/44] illegal generic type for instanceof checks (IDEA-76997) --- .../impl/analysis/GenericsHighlightUtil.java | 7 +++++ .../IllegalGenericTypeInInstanceof.java | 27 +++++++++++++++++++ .../daemon/GenericsHighlightingTest.java | 1 + 3 files changed, 35 insertions(+) create mode 100644 java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IllegalGenericTypeInInstanceof.java diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java index 9186a5ba227c..23eb2f2969cc 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java @@ -973,6 +973,13 @@ public class GenericsHighlightUtil { return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, ref, JavaErrorMessages.message("generics.cannot.instanceof.type.parameters")); } + if (resolved instanceof PsiClass) { + final PsiClass containingClass = ((PsiClass)resolved).getContainingClass(); + if (containingClass != null && ref.getQualifier() == null && containingClass.getTypeParameters().length > 0) { + return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, typeElement, JavaErrorMessages.message("illegal.generic.type.for.instanceof")); + } + } + final PsiType[] parameters = ref.getTypeParameters(); for (PsiType parameterType : parameters) { if (parameterType != null && diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IllegalGenericTypeInInstanceof.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IllegalGenericTypeInInstanceof.java new file mode 100644 index 000000000000..bb183a1c2622 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IllegalGenericTypeInInstanceof.java @@ -0,0 +1,27 @@ +class A { + public void foo(Object object) { + if (object instanceof B) {} + if (object instanceof A.B) {} + if (object instanceof A.B) {} + if (object instanceof A) {} + if (object instanceof A) {} + if (object instanceof A) {} + if (object instanceof A[]) {} + if (object instanceof B[]) {} + if (object instanceof A.B[]) {} + } + + private class B { + } +} + +class A1 { + public void foo(Object object) { + if (object instanceof B1) {} + if (object instanceof A1.B1) {} + if (object instanceof B1[]) {} + } + + private class B1 { + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java index 246a97b67eb6..e86b90d047ac 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -132,6 +132,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase { public void testIDEA74899() throws Exception {doTest(false);} public void testIDEA63291() throws Exception {doTest(false);} public void testIDEA72912() throws Exception {doTest(false);} + public void testIllegalGenericTypeInInstanceof() throws Exception {doTest(false);} public void testJavaUtilCollections_NoVerify() throws Exception { PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule())); From 36ae1aa2b60215d62b052c459ebe223545af49c0 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 17 Apr 2012 14:18:35 +0400 Subject: [PATCH 06/44] cleanup --- .../openapi/editor/impl/MarkupModelImpl.java | 2 +- .../vfs/impl/VirtualFilePointerManagerImpl.java | 16 ++++++++-------- .../openapi/vfs/impl/jar/JarFileSystemImpl.java | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java index dbf009d2ea8d..9f291f683e54 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java @@ -91,7 +91,7 @@ public class MarkupModelImpl extends UserDataHolderBase implements MarkupModelEx return addRangeHighlighterAndChangeAttributes(offset, offset, layer, textAttributes, HighlighterTargetArea.LINES_IN_RANGE, true, null); } - static int getFirstNonspaceCharOffset(@NotNull Document doc, int lineNumber) { + private static int getFirstNonspaceCharOffset(@NotNull Document doc, int lineNumber) { int lineStart = doc.getLineStartOffset(lineNumber); int lineEnd = doc.getLineEndOffset(lineNumber); CharSequence text = doc.getCharsSequence(); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/VirtualFilePointerManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/VirtualFilePointerManagerImpl.java index afde58208c46..93d834757446 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/VirtualFilePointerManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/VirtualFilePointerManagerImpl.java @@ -134,23 +134,23 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp } private static boolean startsWith(final String url, final String pointerUrl) { - String urlSuffix = stripSuffix(url); - String pointerPrefix = stripToJarPrefix(pointerUrl); - if (urlSuffix.length() > 0) { - return Comparing.equal(stripToJarPrefix(url), pointerPrefix, SystemInfo.isFileSystemCaseSensitive) && - StringUtil.startsWith(urlSuffix, stripSuffix(pointerUrl)); + String urlSuffix = substringAfterJarSeparator(url); + String pointerPrefix = substringBeforeJarSeparator(pointerUrl); + if (!urlSuffix.isEmpty()) { + return Comparing.equal(substringBeforeJarSeparator(url), pointerPrefix, SystemInfo.isFileSystemCaseSensitive) && + StringUtil.startsWith(urlSuffix, substringAfterJarSeparator(pointerUrl)); } - return FileUtil.startsWith(pointerPrefix, stripToJarPrefix(url)); + return FileUtil.startsWith(pointerPrefix, substringBeforeJarSeparator(url)); } - private static String stripToJarPrefix(String url) { + private static String substringBeforeJarSeparator(String url) { int separatorIndex = url.indexOf(JarFileSystem.JAR_SEPARATOR); if (separatorIndex < 0) return url; return url.substring(0, separatorIndex); } - private static String stripSuffix(String url) { + private static String substringAfterJarSeparator(String url) { int separatorIndex = url.indexOf(JarFileSystem.JAR_SEPARATOR); if (separatorIndex < 0) return ""; return url.substring(separatorIndex + JarFileSystem.JAR_SEPARATOR.length()); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java index ee58d65f44ba..12337975ee83 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java @@ -28,6 +28,7 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.*; import com.intellij.openapi.vfs.newvfs.*; import com.intellij.openapi.vfs.newvfs.events.VFileEvent; +import com.intellij.util.ArrayUtil; import com.intellij.util.containers.ConcurrentHashSet; import com.intellij.util.messages.MessageBus; import com.intellij.util.text.CaseInsensitiveStringHashingStrategy; @@ -76,11 +77,10 @@ public class JarFileSystemImpl extends JarFileSystem implements ApplicationCompo String[] jarPaths; synchronized (LOCK) { - if (jarPathsCache == null) { - Set jarPathsSet = myHandlers.keySet(); - jarPathsCache = jarPathsSet.toArray(new String[jarPathsSet.size()]); - } jarPaths = jarPathsCache; + if (jarPaths == null) { + jarPathsCache = jarPaths = ArrayUtil.toStringArray(myHandlers.keySet()); + } } for (String jarPath : jarPaths) { From 8c7d3c6fd3b3d9a14f742c22d7131eff69b25040 Mon Sep 17 00:00:00 2001 From: Eugene Kudelevsky Date: Tue, 17 Apr 2012 15:14:01 +0400 Subject: [PATCH 07/44] html5 fixes: return xhtml schema from XmlDocument, return xhtml4 schema location if html4 is chosen as default language level --- .../javaee/ExternalResourceManagerImpl.java | 3 ++- .../javaee/HtmlLanguageLevelForm.java | 2 +- .../psi/impl/source/xml/XmlDocumentImpl.java | 10 +++++++++- .../src/com/intellij/xml/util/XmlUtil.java | 19 ++++++++++++++----- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/xml/impl/src/com/intellij/javaee/ExternalResourceManagerImpl.java b/xml/impl/src/com/intellij/javaee/ExternalResourceManagerImpl.java index 76a786182ce8..d2119ef9c9e0 100644 --- a/xml/impl/src/com/intellij/javaee/ExternalResourceManagerImpl.java +++ b/xml/impl/src/com/intellij/javaee/ExternalResourceManagerImpl.java @@ -417,7 +417,8 @@ public class ExternalResourceManagerImpl extends ExternalResourceManagerEx imple @Override @NotNull public String getDefaultHtmlDoctype(@NotNull Project project) { - return getProjectResources(project).myDefaultHtmlDoctype; + final String doctype = getProjectResources(project).myDefaultHtmlDoctype; + return XmlUtil.XHTML_URI.equals(doctype) ? XmlUtil.XHTML4_SCHEMA_LOCATION : doctype; } @Override diff --git a/xml/impl/src/com/intellij/javaee/HtmlLanguageLevelForm.java b/xml/impl/src/com/intellij/javaee/HtmlLanguageLevelForm.java index f978d1da683e..ba5f870f9273 100644 --- a/xml/impl/src/com/intellij/javaee/HtmlLanguageLevelForm.java +++ b/xml/impl/src/com/intellij/javaee/HtmlLanguageLevelForm.java @@ -80,7 +80,7 @@ public class HtmlLanguageLevelForm { } public void resetFromDoctype(String doctype) { - if (doctype == null || doctype.length() == 0 || doctype.equals(XmlUtil.XHTML_URI)) { + if (doctype == null || doctype.length() == 0 || doctype.equals(XmlUtil.XHTML4_SCHEMA_LOCATION)) { myHtml4RadioButton.setSelected(true); myDoctypeTextField.setEnabled(false); } diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java index 2a9ba82516e3..cc2cb22980ed 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java @@ -43,6 +43,7 @@ import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.xml.*; import com.intellij.util.IncorrectOperationException; import com.intellij.util.containers.ConcurrentHashMap; +import com.intellij.xml.Html5SchemaProvider; import com.intellij.xml.XmlExtension; import com.intellij.xml.XmlNSDescriptor; import com.intellij.xml.util.XmlNSDescriptorSequence; @@ -207,12 +208,19 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { if (nsDescriptor == null) { String htmlns = ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(getProject()); if (htmlns == null || htmlns.length() == 0) { - htmlns = XmlUtil.XHTML_URI; + htmlns = Html5SchemaProvider.HTML5_SCHEMA_LOCATION; } nsDescriptor = getDefaultNSDescriptor(htmlns, false); } return new HtmlNSDescriptorImpl(nsDescriptor); } + else if (XmlUtil.XHTML_URI.equals(namespace)) { + String xhtmlNamespace = XmlUtil.getDefaultXhtmlNamespace(getProject()); + if (xhtmlNamespace == null || xhtmlNamespace.length() == 0) { + xhtmlNamespace = Html5SchemaProvider.XHTML5_SCHEMA_LOCATION; + } + return getDefaultNSDescriptor(xhtmlNamespace, false); + } else if (namespace != null && namespace != XmlUtil.EMPTY_URI) { if (doctype == null || !namespace.equals(XmlUtil.getDtdUri(doctype))) { boolean documentIsSchemaThatDefinesNs = namespace.equals(XmlUtil.getTargetSchemaNsFromTag(getRootTag())); diff --git a/xml/impl/src/com/intellij/xml/util/XmlUtil.java b/xml/impl/src/com/intellij/xml/util/XmlUtil.java index 8fff78934727..ff45a36b38c3 100644 --- a/xml/impl/src/com/intellij/xml/util/XmlUtil.java +++ b/xml/impl/src/com/intellij/xml/util/XmlUtil.java @@ -19,6 +19,7 @@ import com.intellij.codeInsight.completion.CompletionUtil; import com.intellij.codeInsight.daemon.Validator; import com.intellij.javaee.ExternalResourceManager; import com.intellij.javaee.ExternalResourceManagerEx; +import com.intellij.javaee.ExternalResourceManagerImpl; import com.intellij.javaee.UriUtil; import com.intellij.lang.ASTNode; import com.intellij.lang.Language; @@ -35,9 +36,11 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.patterns.StandardPatterns; import com.intellij.patterns.StringPattern; @@ -74,6 +77,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; +import java.net.URL; import java.util.*; /** @@ -152,10 +156,16 @@ public class XmlUtil { @NonNls public static final String WSDL_SCHEMA_URI = "http://schemas.xmlsoap.org/wsdl/"; public static final Key ORIGINAL_ELEMENT = Key.create("ORIGINAL_ELEMENT"); + public static final String XHTML4_SCHEMA_LOCATION; private XmlUtil() { } + static { + final URL xhtml4SchemaLocationUrl = XmlUtil.class.getResource(ExternalResourceManagerImpl.STANDARD_SCHEMAS + "xhtml1-transitional.xsd"); + XHTML4_SCHEMA_LOCATION = VfsUtil.urlToPath(VfsUtil.fixURLforIDEA(FileUtil.unquote(xhtml4SchemaLocationUrl.toExternalForm()))); + } + @Nullable public static String getSchemaLocation(XmlTag tag, String namespace) { final String uri = ExternalResourceManagerEx.getInstanceEx().getResourceLocation(namespace, tag.getProject()); @@ -604,11 +614,10 @@ public class XmlUtil { } public static String getDefaultXhtmlNamespace(Project project) { - String defaultHtmlDoctype = ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(project); - if (Html5SchemaProvider.HTML5_SCHEMA_LOCATION.equals(defaultHtmlDoctype)) { - defaultHtmlDoctype = Html5SchemaProvider.XHTML5_SCHEMA_LOCATION; - } - return defaultHtmlDoctype; + final String doctype = ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(project); + return Html5SchemaProvider.HTML5_SCHEMA_LOCATION.equals(doctype) + ? Html5SchemaProvider.XHTML5_SCHEMA_LOCATION + : doctype; } // //public static void expandTag(@NotNull XmlTag tag) { From e931f0d02f460209274caf0ee5d6424b3bab7a34 Mon Sep 17 00:00:00 2001 From: Eugene Kudelevsky Date: Tue, 17 Apr 2012 15:16:10 +0400 Subject: [PATCH 08/44] change create html file action: html5 is by default now --- .../src/com/intellij/ide/actions/CreateHtmlFileAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml/impl/src/com/intellij/ide/actions/CreateHtmlFileAction.java b/xml/impl/src/com/intellij/ide/actions/CreateHtmlFileAction.java index 7bc5112917cc..cbf690cf4ceb 100644 --- a/xml/impl/src/com/intellij/ide/actions/CreateHtmlFileAction.java +++ b/xml/impl/src/com/intellij/ide/actions/CreateHtmlFileAction.java @@ -43,8 +43,8 @@ public class CreateHtmlFileAction extends CreateFileFromTemplateAction implement protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) { builder .setTitle(XmlBundle.message("new.html.file.action")) - .addKind("HTML file", StdFileTypes.HTML.getIcon(), FileTemplateManager.INTERNAL_HTML_TEMPLATE_NAME) - .addKind("HTML5 file", StdFileTypes.HTML.getIcon(), FileTemplateManager.INTERNAL_HTML5_TEMPLATE_NAME) + .addKind("HTML file", StdFileTypes.HTML.getIcon(), FileTemplateManager.INTERNAL_HTML5_TEMPLATE_NAME) + .addKind("HTML4 file", StdFileTypes.HTML.getIcon(), FileTemplateManager.INTERNAL_HTML_TEMPLATE_NAME) .addKind("XHTML file", StdFileTypes.XHTML.getIcon(), FileTemplateManager.INTERNAL_XHTML_TEMPLATE_NAME); } From c50fb806828a49ad33f26ab557f4a01fa1453f92 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 17 Apr 2012 15:49:38 +0400 Subject: [PATCH 09/44] Fix saving state of the checkbox "auto-commit on cherry-pick". --- plugins/git4idea/src/git4idea/config/GitVcsPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/config/GitVcsPanel.java b/plugins/git4idea/src/git4idea/config/GitVcsPanel.java index 6eedc1507ba3..d031d595c1d1 100644 --- a/plugins/git4idea/src/git4idea/config/GitVcsPanel.java +++ b/plugins/git4idea/src/git4idea/config/GitVcsPanel.java @@ -164,7 +164,7 @@ public class GitVcsPanel { !crlfPolicyItem(settings).equals(myConvertTextFilesComboBox.getSelectedItem()) || !settings.autoUpdateIfPushRejected() == myAutoUpdateIfPushRejected.isSelected() || ((settings.getSyncSetting() == GitBranchSyncSetting.SYNC) != mySyncBranchControl.isSelected() || - settings.isAutoCommitOnCherryPick() == myAutoCommitOnCherryPick.isSelected()); + settings.isAutoCommitOnCherryPick() != myAutoCommitOnCherryPick.isSelected()); } /** From 35b1953a938ce9be1b20e246f7ac65c1f41dd3eb Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 17 Apr 2012 14:02:14 +0200 Subject: [PATCH 10/44] IDEA-84698 Completion: shows focussed element way-off current completion list popup --- .../lookup/impl/CompletionExtender.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/CompletionExtender.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/CompletionExtender.java index 3ff721a98175..99e9b05e7517 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/CompletionExtender.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/CompletionExtender.java @@ -17,11 +17,14 @@ package com.intellij.codeInsight.lookup.impl; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.ui.HeavyweightHint; +import com.intellij.ui.awt.RelativePoint; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; /** * @author Konstantin Bulenkov @@ -36,6 +39,17 @@ public class CompletionExtender extends HeavyweightHint { myElement = element; myLookup = lookup; myIndex = myLookup.getList().getSelectedIndex(); + myLookup.getComponent().addComponentListener(new ComponentAdapter() { + @Override + public void componentResized(ComponentEvent e) { + recalculateLocation(); + } + + @Override + public void componentMoved(ComponentEvent e) { + recalculateLocation(); + } + }); } public LookupElement getLookupElement() { @@ -74,6 +88,18 @@ public class CompletionExtender extends HeavyweightHint { return false; } + void recalculateLocation() { + if (!isVisible()) return; + final JList list = myLookup.getList(); + final Point p = list.getLocationOnScreen(); + p.y += list.indexToLocation(list.getSelectedIndex()).y; + final JComponent rootPane = UIUtil.getRootPane(myLookup.getEditor().getContentComponent()); + if (rootPane != null) { + SwingUtilities.convertPointFromScreen(p, rootPane); + setLocation(new RelativePoint(rootPane, p)); + } + } + @Override public void hide() { super.hide(); From 09bef1e166f3c64df7768f61c69abb90790b602e Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 17 Apr 2012 14:07:26 +0200 Subject: [PATCH 11/44] improve descriptions --- .../src/inspectionDescriptions/UtilityClass.html | 3 ++- .../UtilityClassWithoutPrivateConstructor.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClass.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClass.html index 60c176c7dc68..0db80e730d40 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClass.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClass.html @@ -5,7 +5,8 @@ Utility classes have all fields and methods declared static, and their presence may indicate a lack of object-oriented design.

-Use the list below to ignore classes which are annotated by the annotations added to the list. +Use the list below to specify special annotations. Classes annotated with one of +these annotations will be ignored by this inspection.

Powered by InspectionGadgets diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClassWithoutPrivateConstructor.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClassWithoutPrivateConstructor.html index 802af705f5f1..012ce5634fbc 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClassWithoutPrivateConstructor.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UtilityClassWithoutPrivateConstructor.html @@ -5,7 +5,8 @@ Utility classes have all fields and methods declared static. Giving such constructor prevents them from being inadvertently instantiated.

-Use the list below to ignore classes which are annotated by the annotations added to the list. +Use the list below to specify special annotations. Classes annotated with one of +these annotations will be ignored by this inspection.

Use the checkbox below to ignore classes which only have a main method and no other methods.

From 9b372fae29ff0223c80c81223bb3a7832b1aa07e Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 17 Apr 2012 14:10:03 +0200 Subject: [PATCH 12/44] improve quickfix text --- .../siyeh/InspectionGadgetsBundle.properties | 3 +- .../AddToIgnoreIfAnnotatedByListQuickFix.java | 30 +++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties index 013f1a273a15..ed07c640c0c5 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties @@ -1970,4 +1970,5 @@ ambiguous.field.access.hides.parameter.problem.descriptor=Field #ref#ref from super class ''{0}'' accessed, while field access from surrounding class might be expected #loc ambiguous.field.access.quickfix=Qualify field access with 'super.' string.builder.replaceable.by.string.quickfix=Replace 'StringBuilder' with 'String' -string.buffer.replaceable.by.string.quickfix=Replace 'StringBuffer' with 'String' \ No newline at end of file +string.buffer.replaceable.by.string.quickfix=Replace 'StringBuffer' with 'String' +add.0.to.ignore.if.annotated.by.list.quickfix=Add ''{0}'' to ''Ignore if annotated by'' list \ No newline at end of file diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/AddToIgnoreIfAnnotatedByListQuickFix.java b/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/AddToIgnoreIfAnnotatedByListQuickFix.java index 594f6f23b42a..0f8757324903 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/AddToIgnoreIfAnnotatedByListQuickFix.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/AddToIgnoreIfAnnotatedByListQuickFix.java @@ -17,10 +17,14 @@ package com.siyeh.ig.fixes; import com.intellij.codeInsight.daemon.QuickFixBundle; import com.intellij.codeInspection.util.SpecialAnnotationsUtil; +import com.intellij.psi.PsiAnnotation; +import com.intellij.psi.PsiModifierList; import com.intellij.psi.PsiModifierListOwner; import com.intellij.util.Processor; +import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.DelegatingFix; import com.siyeh.ig.InspectionGadgetsFix; +import org.jetbrains.annotations.NonNls; import java.util.ArrayList; import java.util.List; @@ -32,7 +36,6 @@ public class AddToIgnoreIfAnnotatedByListQuickFix { private AddToIgnoreIfAnnotatedByListQuickFix() {} - public static InspectionGadgetsFix[] build(PsiModifierListOwner modifierListOwner, List configurationList) { final List fixes = build(modifierListOwner, configurationList, new ArrayList()); return fixes.isEmpty() ? InspectionGadgetsFix.EMPTY_ARRAY : fixes.toArray(new InspectionGadgetsFix[fixes.size()]); @@ -41,16 +44,33 @@ public class AddToIgnoreIfAnnotatedByListQuickFix { public static List build(final PsiModifierListOwner modifierListOwner, final List configurationList, final List fixes) { - SpecialAnnotationsUtil.createAddToSpecialAnnotationFixes(modifierListOwner, new Processor() { + processAnnotationTexts(modifierListOwner, new Processor() { @Override - public boolean process(String qualifiedName) { + public boolean process(String annotationText) { fixes.add(new DelegatingFix(SpecialAnnotationsUtil.createAddToSpecialAnnotationsListQuickFix( - "Add '" + qualifiedName + "' to 'ignore if annotated by' list", // add '@asdf' to 'ignore if annotated by' list + InspectionGadgetsBundle.message("add.0.to.ignore.if.annotated.by.list.quickfix", annotationText), QuickFixBundle.message("fix.add.special.annotation.family"), - configurationList, qualifiedName, modifierListOwner))); + configurationList, annotationText, modifierListOwner))); return true; } }); return fixes; } + + private static void processAnnotationTexts(final PsiModifierListOwner owner, final Processor processor) { + final PsiModifierList modifierList = owner.getModifierList(); + if (modifierList == null) { + return; + } + final PsiAnnotation[] annotations = modifierList.getAnnotations(); + for (PsiAnnotation annotation : annotations) { + @NonNls final String text = annotation.getText(); + if (text.startsWith("java.") || text.startsWith("javax.") || text.startsWith("org.jetbrains.")) { + continue; + } + if (!processor.process(text)) { + break; + } + } + } } From 884ad30be7d465e36138696b3d95b5d9cd3379f7 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 17 Apr 2012 14:23:32 +0200 Subject: [PATCH 13/44] Add "Add to Special Annotations" quickfix to inspections that have "Special Annotations" --- ...MethodNotExposedInInterfaceInspection.java | 27 +++++------ .../ig/classlayout/EmptyClassInspection.java | 12 +++++ .../encapsulation/PublicFieldInspection.java | 13 ++++-- ...nceVariableUninitializedUseInspection.java | 46 +++++++++---------- ...bleFieldInSerializableClassInspection.java | 16 +++++-- 5 files changed, 70 insertions(+), 44 deletions(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/PublicMethodNotExposedInInterfaceInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/PublicMethodNotExposedInInterfaceInspection.java index 99224547564d..808ddca84208 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/PublicMethodNotExposedInInterfaceInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/PublicMethodNotExposedInInterfaceInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2012 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,13 @@ package com.siyeh.ig.abstraction; import com.intellij.codeInsight.AnnotationUtil; import com.intellij.codeInspection.util.SpecialAnnotationsUtil; -import com.intellij.psi.CommonClassNames; -import com.intellij.psi.PsiClass; -import com.intellij.psi.PsiMethod; -import com.intellij.psi.PsiModifier; +import com.intellij.psi.*; import com.intellij.util.ui.CheckBox; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; +import com.siyeh.ig.InspectionGadgetsFix; +import com.siyeh.ig.fixes.AddToIgnoreIfAnnotatedByListQuickFix; import com.siyeh.ig.psiutils.LibraryUtil; import com.siyeh.ig.psiutils.TestUtils; import com.siyeh.ig.ui.ExternalizableStringSet; @@ -57,14 +56,17 @@ public class PublicMethodNotExposedInInterfaceInspection "public.method.not.in.interface.problem.descriptor"); } + @NotNull + @Override + protected InspectionGadgetsFix[] buildFixes(Object... infos) { + return AddToIgnoreIfAnnotatedByListQuickFix.build((PsiModifierListOwner)infos[0], ignorableAnnotations); + } + @Override public JComponent createOptionsPanel() { final JPanel panel = new JPanel(new GridBagLayout()); - final JPanel annotationsListControl = - SpecialAnnotationsUtil.createSpecialAnnotationsListControl( - ignorableAnnotations, - InspectionGadgetsBundle.message( - "ignore.if.annotated.by")); + final JPanel annotationsListControl = SpecialAnnotationsUtil.createSpecialAnnotationsListControl( + ignorableAnnotations, InspectionGadgetsBundle.message("ignore.if.annotated.by")); final GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; @@ -74,8 +76,7 @@ public class PublicMethodNotExposedInInterfaceInspection constraints.fill = GridBagConstraints.BOTH; panel.add(annotationsListControl, constraints); final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message( - "public.method.not.in.interface.option"), - this, "onlyWarnIfContainingClassImplementsAnInterface"); + "public.method.not.in.interface.option"), this, "onlyWarnIfContainingClassImplementsAnInterface"); constraints.gridy = 1; constraints.weighty = 0.0; constraints.anchor = GridBagConstraints.WEST; @@ -141,7 +142,7 @@ public class PublicMethodNotExposedInInterfaceInspection if (TestUtils.isJUnitTestMethod(method)) { return; } - registerMethodError(method); + registerMethodError(method, method); } private boolean exposedInInterface(PsiMethod method) { diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/EmptyClassInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/EmptyClassInspection.java index c0e4787d23ee..7b543f7fb266 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/EmptyClassInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/EmptyClassInspection.java @@ -23,6 +23,8 @@ import com.intellij.util.ui.CheckBox; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; +import com.siyeh.ig.InspectionGadgetsFix; +import com.siyeh.ig.fixes.AddToIgnoreIfAnnotatedByListQuickFix; import com.siyeh.ig.ui.ExternalizableStringSet; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -87,6 +89,16 @@ public class EmptyClassInspection extends BaseInspection { return panel; } + @NotNull + @Override + protected InspectionGadgetsFix[] buildFixes(Object... infos) { + final Object info = infos[0]; + if (!(info instanceof PsiModifierListOwner)) { + return InspectionGadgetsFix.EMPTY_ARRAY; + } + return AddToIgnoreIfAnnotatedByListQuickFix.build((PsiModifierListOwner)info, ignorableAnnotations); + } + @Override public BaseInspectionVisitor buildVisitor() { return new EmptyClassVisitor(); diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/encapsulation/PublicFieldInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/encapsulation/PublicFieldInspection.java index d85659757e76..aca4a96f814a 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/encapsulation/PublicFieldInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/encapsulation/PublicFieldInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2012 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; import com.siyeh.ig.InspectionGadgetsFix; +import com.siyeh.ig.fixes.AddToIgnoreIfAnnotatedByListQuickFix; import com.siyeh.ig.fixes.EncapsulateVariableFix; import com.siyeh.ig.psiutils.ClassUtils; import com.siyeh.ig.ui.ExternalizableStringSet; @@ -31,6 +32,8 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; +import java.util.List; public class PublicFieldInspection extends BaseInspection { @@ -66,10 +69,14 @@ public class PublicFieldInspection extends BaseInspection { return panel; } + @NotNull @Override - protected InspectionGadgetsFix buildFix(Object... infos) { + protected InspectionGadgetsFix[] buildFixes(Object... infos) { + final List fixes = new ArrayList(); final PsiField field = (PsiField)infos[0]; - return new EncapsulateVariableFix(field.getName()); + fixes.add(new EncapsulateVariableFix(field.getName())); + AddToIgnoreIfAnnotatedByListQuickFix.build(field, ignorableAnnotations, fixes); + return fixes.toArray(new InspectionGadgetsFix[fixes.size()]); } @Override diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/initialization/InstanceVariableUninitializedUseInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/initialization/InstanceVariableUninitializedUseInspection.java index c2a6b4dfa29d..e692c19069b5 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/initialization/InstanceVariableUninitializedUseInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/initialization/InstanceVariableUninitializedUseInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2012 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,8 @@ import com.intellij.util.ui.CheckBox; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; +import com.siyeh.ig.InspectionGadgetsFix; +import com.siyeh.ig.fixes.AddToIgnoreIfAnnotatedByListQuickFix; import com.siyeh.ig.psiutils.ClassUtils; import com.siyeh.ig.psiutils.UninitializedReadCollector; import org.jdom.Element; @@ -39,8 +41,7 @@ import java.awt.GridBagLayout; import java.util.ArrayList; import java.util.List; -public class InstanceVariableUninitializedUseInspection - extends BaseInspection { +public class InstanceVariableUninitializedUseInspection extends BaseInspection { /** * @noinspection PublicField @@ -94,10 +95,8 @@ public class InstanceVariableUninitializedUseInspection public JComponent createOptionsPanel() { final JComponent panel = new JPanel(new GridBagLayout()); - final JPanel annotationsPanel = - SpecialAnnotationsUtil.createSpecialAnnotationsListControl( - annotationNames, InspectionGadgetsBundle.message( - "ignore.if.annotated.by")); + final JPanel annotationsPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl( + annotationNames, InspectionGadgetsBundle.message("ignore.if.annotated.by")); final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message( "primitive.fields.ignore.option"), this, "m_ignorePrimitives"); @@ -117,13 +116,19 @@ public class InstanceVariableUninitializedUseInspection return panel; } + @NotNull + @Override + protected InspectionGadgetsFix[] buildFixes(Object... infos) { + final PsiField field = (PsiField)infos[0]; + return AddToIgnoreIfAnnotatedByListQuickFix.build(field, annotationNames); + } + @Override public BaseInspectionVisitor buildVisitor() { return new InstanceVariableInitializationVisitor(); } - private class InstanceVariableInitializationVisitor - extends BaseInspectionVisitor { + private class InstanceVariableInitializationVisitor extends BaseInspectionVisitor { @Override public void visitField(@NotNull PsiField field) { @@ -133,8 +138,7 @@ public class InstanceVariableUninitializedUseInspection if (field.getInitializer() != null) { return; } - final PsiAnnotation annotation = - AnnotationUtil.findAnnotation(field, annotationNames); + final PsiAnnotation annotation = AnnotationUtil.findAnnotation(field, annotationNames); if (annotation != null) { return; } @@ -154,26 +158,21 @@ public class InstanceVariableUninitializedUseInspection return; } } - final UninitializedReadCollector uninitializedReadsCollector = - new UninitializedReadCollector(); - if (!isInitializedInInitializer(field, - uninitializedReadsCollector)) { + final UninitializedReadCollector uninitializedReadsCollector = new UninitializedReadCollector(); + if (!isInitializedInInitializer(field, uninitializedReadsCollector)) { final PsiMethod[] constructors = aClass.getConstructors(); for (final PsiMethod constructor : constructors) { final PsiCodeBlock body = constructor.getBody(); - uninitializedReadsCollector.blockAssignsVariable(body, - field); + uninitializedReadsCollector.blockAssignsVariable(body, field); } } - final PsiExpression[] badReads = - uninitializedReadsCollector.getUninitializedReads(); + final PsiExpression[] badReads = uninitializedReadsCollector.getUninitializedReads(); for (PsiExpression expression : badReads) { - registerError(expression); + registerError(expression, field); } } - private boolean isInitializedInInitializer( - @NotNull PsiField field, + private boolean isInitializedInInitializer(@NotNull PsiField field, UninitializedReadCollector uninitializedReadsCollector) { final PsiClass aClass = field.getContainingClass(); if (aClass == null) { @@ -183,8 +182,7 @@ public class InstanceVariableUninitializedUseInspection for (final PsiClassInitializer initializer : initializers) { if (!initializer.hasModifierProperty(PsiModifier.STATIC)) { final PsiCodeBlock body = initializer.getBody(); - if (uninitializedReadsCollector.blockAssignsVariable(body, - field)) { + if (uninitializedReadsCollector.blockAssignsVariable(body, field)) { return true; } } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/serialization/NonSerializableFieldInSerializableClassInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/serialization/NonSerializableFieldInSerializableClassInspection.java index a4d462f0eee5..00eb633b7cc9 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/serialization/NonSerializableFieldInSerializableClassInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/serialization/NonSerializableFieldInSerializableClassInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2011 Dave Griffith, Bas Leijdekkers + * Copyright 2006-2012 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,15 @@ import com.intellij.psi.PsiField; import com.intellij.psi.PsiModifier; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspectionVisitor; +import com.siyeh.ig.InspectionGadgetsFix; +import com.siyeh.ig.fixes.AddToIgnoreIfAnnotatedByListQuickFix; import com.siyeh.ig.psiutils.SerializationUtils; import com.siyeh.ig.ui.ExternalizableStringSet; import org.jetbrains.annotations.NotNull; import javax.swing.*; -public class NonSerializableFieldInSerializableClassInspection - extends SerializableInspection { +public class NonSerializableFieldInSerializableClassInspection extends SerializableInspection { @SuppressWarnings({"PublicField"}) public final ExternalizableStringSet ignorableAnnotations = new ExternalizableStringSet(); @@ -55,6 +56,13 @@ public class NonSerializableFieldInSerializableClassInspection ignorableAnnotations, InspectionGadgetsBundle.message("ignore.if.annotated.by"))}; } + @NotNull + @Override + protected InspectionGadgetsFix[] buildFixes(Object... infos) { + final PsiField field = (PsiField)infos[0]; + return AddToIgnoreIfAnnotatedByListQuickFix.build(field, ignorableAnnotations); + } + @Override public BaseInspectionVisitor buildVisitor() { return new NonSerializableFieldInSerializableClassVisitor(); @@ -90,7 +98,7 @@ public class NonSerializableFieldInSerializableClassInspection if (AnnotationUtil.isAnnotated(field, ignorableAnnotations)) { return; } - registerFieldError(field); + registerFieldError(field, field); } } } \ No newline at end of file From 37df9ee14820d9e1924954364d335ac8821b51bd Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 17 Apr 2012 14:24:05 +0200 Subject: [PATCH 14/44] improve descriptions --- .../src/inspectionDescriptions/EmptyClass.html | 1 + .../InstanceVariableUninitializedUse.html | 8 ++++++-- .../NonSerializableFieldInSerializableClass.html | 6 +++++- .../src/inspectionDescriptions/PublicField.html | 1 + .../PublicMethodNotExposedInInterface.html | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/EmptyClass.html b/plugins/InspectionGadgets/src/inspectionDescriptions/EmptyClass.html index 11084c2b9191..a127f913ffd8 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/EmptyClass.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/EmptyClass.html @@ -3,6 +3,7 @@ This inspection reports empty classes and Java files without any defined classes. A class is empty if it doesn't have any fields, methods, constructors or initializers. Empty classes are often left over after large changes or refactorings. +

Use the list below to specify special annotations. Classes annotated with one of these annotations will be ignored by this inspection. diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/InstanceVariableUninitializedUse.html b/plugins/InspectionGadgets/src/inspectionDescriptions/InstanceVariableUninitializedUse.html index 58616d14b98e..4b0e5a48b4c1 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/InstanceVariableUninitializedUse.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/InstanceVariableUninitializedUse.html @@ -2,10 +2,14 @@ This inspection reports reads of instance variables which are not yet initialized.

-Use the checkbox below to indicate whether you want uninitialized primitive fields to be reported. -

Note: This inspection uses a very conservative dataflow algorithm, and may report instance variables as uninitialized incorrectly. Variables reported as initialized will always be initialized. + +

+Use the list below to specify special annotations. Fields annotated with one of +these annotations will be ignored by this inspection. +

+Use the checkbox below to indicate whether you want uninitialized primitive fields to be reported.

Powered by InspectionGadgets diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/NonSerializableFieldInSerializableClass.html b/plugins/InspectionGadgets/src/inspectionDescriptions/NonSerializableFieldInSerializableClass.html index 5e38286da202..993ffb6ce652 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/NonSerializableFieldInSerializableClass.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/NonSerializableFieldInSerializableClass.html @@ -10,12 +10,16 @@ method. For purposes of this inspection, fields with java.util.Map types are assumed to be Serializable, unless the types they are declared to contain are non-Serializable. +

-Use the table below to specify what specific classes and inheritors should be excluded +Use the first list below to specify what specific classes and inheritors should be excluded from being checked by this inspection. This is meant for those classes which, although they inherit Serializable from a superclass, are not intended for serialization. Such classes would lead this inspection to report unnecessarily.

+Use the second list below to specify special annotations. Fields annotated with one of +these annotations will be ignored by this inspection. +

Powered by InspectionGadgets \ No newline at end of file diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/PublicField.html b/plugins/InspectionGadgets/src/inspectionDescriptions/PublicField.html index af58c31186a5..7d0c3238ca8a 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/PublicField.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/PublicField.html @@ -2,6 +2,7 @@ This inspection reports public instance variables. Constants (i.e. variables marked static and final) are not reported. +

Use the list below to specify special annotations. Fields annotated with one of these annotations will be ignored by this inspection.

diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/PublicMethodNotExposedInInterface.html b/plugins/InspectionGadgets/src/inspectionDescriptions/PublicMethodNotExposedInInterface.html index bc21479d9c2f..5d50ce17e6d9 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/PublicMethodNotExposedInInterface.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/PublicMethodNotExposedInInterface.html @@ -3,6 +3,7 @@ This inspection reports public methods in classes which are not exposed as in interface. Exposing all public methods via interface is important for maintaining loose coupling, and may be necessary for certain component-based programming styles. +

Use the list below to specify special annotations. Methods annotated with one of these annotations will be ignored by this inspection. From ad84c6b92f8a47274e6abe6967e282ff378b0c25 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 17 Apr 2012 13:43:38 +0200 Subject: [PATCH 15/44] present captured wildcards in quick doc e.g. class.getTypeParameters --- .../intellij/codeInsight/javadoc/JavaDocInfoGenerator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java index 2f18c00301b0..b7222381c9e2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java +++ b/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java @@ -1506,6 +1506,10 @@ public class JavaDocInfoGenerator { } } + if (type instanceof PsiCapturedWildcardType) { + type = ((PsiCapturedWildcardType)type).getWildcard(); + } + if (type instanceof PsiWildcardType){ PsiWildcardType wt = ((PsiWildcardType)type); From 22b0902a35d61095fabdce04ca092e0f99c361fd Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 17 Apr 2012 14:23:14 +0200 Subject: [PATCH 16/44] inspections config tree: sort sub groups correctly (IDEA-84750) --- .../codeInspection/ui/InspectionsConfigTreeComparator.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeComparator.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeComparator.java index 6783f85dc4d7..80a71ff5a6fb 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeComparator.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionsConfigTreeComparator.java @@ -34,6 +34,13 @@ public class InspectionsConfigTreeComparator implements Comparator Date: Tue, 17 Apr 2012 14:49:04 +0200 Subject: [PATCH 17/44] add "Utility class" inspection to inspection-black-list.txt --- .../src/com/intellij/codeInspection/inspection-black-list.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/inspection-black-list.txt b/platform/lang-impl/src/com/intellij/codeInspection/inspection-black-list.txt index 0310181f4ccb..9527d222bb38 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/inspection-black-list.txt +++ b/platform/lang-impl/src/com/intellij/codeInspection/inspection-black-list.txt @@ -78,6 +78,7 @@ com.siyeh.ig.classlayout.EmptyClassInspection com.siyeh.ig.classlayout.InnerClassOnInterfaceInspection com.siyeh.ig.classlayout.ListenerMayUseAdapterInspection com.siyeh.ig.classlayout.MissingOverrideAnnotationInspection +com.siyeh.ig.classlayout.UtilityClassInspection com.siyeh.ig.classlayout.UtilityClassWithoutPrivateConstructorInspection com.siyeh.ig.classmetrics.AnonymousClassComplexityInspection com.siyeh.ig.classmetrics.AnonymousClassMethodCountInspection From 2a3e8d382561c5f3f13c05a36de75c8cd117f31d Mon Sep 17 00:00:00 2001 From: Eugene Kudelevsky Date: Tue, 17 Apr 2012 17:19:01 +0400 Subject: [PATCH 18/44] create aapt gen source root in maven resource-processing mode, but not exclude --- .../android/compiler/AndroidCompileUtil.java | 11 +++--- .../compiler/tools/AndroidMavenExecutor.java | 37 ++++++++++++------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java b/plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java index c1db61d2f1bc..53041f9739b3 100644 --- a/plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java +++ b/plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java @@ -655,19 +655,20 @@ public class AndroidCompileUtil { final GlobalSearchScope moduleScope = facet.getModule().getModuleScope(); initializeGenSourceRoot(module, AndroidRootUtil.getRenderscriptGenSourceRootPath(facet), - FileTypeIndex.getFiles(AndroidRenderscriptFileType.INSTANCE, moduleScope).size() > 0); + FileTypeIndex.getFiles(AndroidRenderscriptFileType.INSTANCE, moduleScope).size() > 0, true); if (AndroidAptCompiler.isToCompileModule(module, facet.getConfiguration())) { - initializeGenSourceRoot(module, AndroidRootUtil.getAptGenSourceRootPath(facet), true); + initializeGenSourceRoot(module, AndroidRootUtil.getAptGenSourceRootPath(facet), true, true); } else { // we need to include generated-sources/r to compilation, because it contains R.java generated by Maven, // which should be used in Maven-based resource processing mode + initializeGenSourceRoot(module, AndroidRootUtil.getAptGenSourceRootPath(facet), true, false); includeAaptGenSourceRootToCompilation(facet); } initializeGenSourceRoot(module, AndroidRootUtil.getAidlGenSourceRootPath(facet), - FileTypeIndex.getFiles(AndroidIdlFileType.ourFileType, moduleScope).size() > 0); + FileTypeIndex.getFiles(AndroidIdlFileType.ourFileType, moduleScope).size() > 0, true); } private static void includeAaptGenSourceRootToCompilation(AndroidFacet facet) { @@ -686,7 +687,7 @@ public class AndroidCompileUtil { } } - private static void initializeGenSourceRoot(@NotNull Module module, @Nullable String sourceRootPath, boolean createIfNotExist) { + private static void initializeGenSourceRoot(@NotNull Module module, @Nullable String sourceRootPath, boolean createIfNotExist, boolean exclude) { if (sourceRootPath == null) { return; } @@ -701,7 +702,7 @@ public class AndroidCompileUtil { if (sourceRoot == null) { sourceRoot = LocalFileSystem.getInstance().findFileByPath(sourceRootPath); } - if (sourceRoot != null) { + if (sourceRoot != null && exclude) { excludeFromCompilation(module.getProject(), sourceRoot); } } diff --git a/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidMavenExecutor.java b/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidMavenExecutor.java index 3d0d9ff9d037..0798f83d368f 100644 --- a/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidMavenExecutor.java +++ b/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidMavenExecutor.java @@ -19,14 +19,16 @@ import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.CommandLineBuilder; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.configurations.JavaParameters; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.compiler.CompilerMessageCategory; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; +import com.intellij.openapi.util.Computable; import com.intellij.util.containers.HashMap; import org.jetbrains.android.util.AndroidUtils; import org.jetbrains.android.util.ExecutionStatus; +import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.execution.MavenExternalParameters; -import org.jetbrains.idea.maven.execution.MavenRunner; import org.jetbrains.idea.maven.execution.MavenRunnerParameters; import org.jetbrains.idea.maven.project.MavenProjectsManager; @@ -42,24 +44,39 @@ public class AndroidMavenExecutor { private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.tools.AndroidMavenExecutor"); private static final String BUILD_ERROR_INDICATOR = "[error]"; - private static final String FAILED_TO_RESOLVE_ARTIFACT_INDICATOR = "[info] failed to resolve artifact"; private AndroidMavenExecutor() { } - public static Map> generateResources(Module module) { + public static Map> generateResources(final Module module) { MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(module.getProject()); - MavenRunnerParameters parameters = + final MavenRunnerParameters parameters = new MavenRunnerParameters(true, projectsManager.findProject(module).getDirectory(), Collections.singletonList("process-resources"), projectsManager.getExplicitProfiles()); - Map> result = new HashMap>(); + final Map> result = new HashMap>(); result.put(CompilerMessageCategory.ERROR, new ArrayList()); try { - JavaParameters javaParams = MavenExternalParameters.createJavaParameters(module.getProject(), parameters); + JavaParameters javaParams = ApplicationManager.getApplication().runReadAction(new Computable() { + @Nullable + @Override + public JavaParameters compute() { + try { + return MavenExternalParameters.createJavaParameters(module.getProject(), parameters); + } + catch (ExecutionException e) { + LOG.info(e); + result.get(CompilerMessageCategory.ERROR).add(e.getMessage()); + return null; + } + } + }); + if (javaParams == null) { + return result; + } GeneralCommandLine commandLine = CommandLineBuilder.createFromJavaParameters(javaParams); StringBuilder messageBuilder = new StringBuilder(); @@ -70,13 +87,7 @@ public class AndroidMavenExecutor { String lcmessage = message.toLowerCase(); int buildErrorIndex = lcmessage.indexOf(BUILD_ERROR_INDICATOR); if (buildErrorIndex >= 0) { - int failedToResolveIndex = lcmessage.indexOf(FAILED_TO_RESOLVE_ARTIFACT_INDICATOR); - /*if (failedToResolveIndex >= 0) { - result.get(CompilerMessageCategory.ERROR).add("Failed to copy Android resources from Maven artifacts"); - } - else {*/ - result.get(CompilerMessageCategory.ERROR).add(message.substring(buildErrorIndex)); - //} + result.get(CompilerMessageCategory.ERROR).add(message.substring(buildErrorIndex)); } } } From 7ad10deaa485cc67f89a363d5c8981bb3c87d673 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Tue, 17 Apr 2012 17:25:03 +0400 Subject: [PATCH 19/44] .class literal usage shall mark all constructors used, not just default one. --- .../reference/RefJavaUtilImpl.java | 32 ++++++++++++++----- .../deadCode/classLiteralRef/expected.xml | 4 +++ .../deadCode/classLiteralRef/src/Test.java | 12 +++++++ .../codeInspection/UnusedDeclarationTest.java | 4 +++ 4 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 java/java-tests/testData/inspection/deadCode/classLiteralRef/expected.xml create mode 100644 java/java-tests/testData/inspection/deadCode/classLiteralRef/src/Test.java diff --git a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java index d5c2ea5ded2d..63c25f321f39 100644 --- a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java +++ b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java @@ -75,7 +75,7 @@ public class RefJavaUtilImpl extends RefJavaUtil{ if (refConstructor == null) { // No explicit constructor referenced. Should use default one. PsiType newType = newExpr.getType(); if (newType instanceof PsiClassType) { - processClassReference(PsiUtil.resolveClassInType(newType), refFrom, psiFrom); + processClassReference(PsiUtil.resolveClassInType(newType), refFrom, psiFrom, true); } } } @@ -124,22 +124,38 @@ public class RefJavaUtilImpl extends RefJavaUtil{ final PsiTypeElement operand = expression.getOperand(); final PsiType type = operand.getType(); if (type instanceof PsiClassType) { - processClassReference(((PsiClassType)type).resolve(), refFrom, psiFrom); + processClassReference(((PsiClassType)type).resolve(), refFrom, psiFrom, false); } } - private void processClassReference(final PsiClass psiClass, final RefJavaElementImpl refFrom, final PsiModifierListOwner psiFrom) { + private void processClassReference(final PsiClass psiClass, + final RefJavaElementImpl refFrom, + final PsiModifierListOwner psiFrom, + boolean defaultConstructorOnly) { if (psiClass != null) { RefClassImpl refClass = (RefClassImpl)refFrom.getRefManager().getReference(psiClass); if (refClass != null) { - RefMethodImpl refDefaultConstructor = (RefMethodImpl)refClass.getDefaultConstructor(); + boolean hasConstructorsMarked = false; - if (refDefaultConstructor != null && !(refDefaultConstructor instanceof RefImplicitConstructor)) { - refDefaultConstructor.addInReference(refFrom); - refFrom.addOutReference(refDefaultConstructor); + if (defaultConstructorOnly) { + RefMethodImpl refDefaultConstructor = (RefMethodImpl)refClass.getDefaultConstructor(); + if (refDefaultConstructor != null && !(refDefaultConstructor instanceof RefImplicitConstructor)) { + refDefaultConstructor.addInReference(refFrom); + refFrom.addOutReference(refDefaultConstructor); + hasConstructorsMarked = true; + } } else { + for (RefMethod cons : refClass.getConstructors()) { + if (cons instanceof RefImplicitConstructor) continue; + ((RefMethodImpl)cons).addInReference(refFrom); + refFrom.addOutReference(cons); + hasConstructorsMarked = true; + } + } + + if (!hasConstructorsMarked) { refFrom.addReference(refClass, psiClass, psiFrom, false, true, null); } } @@ -385,4 +401,4 @@ public class RefJavaUtilImpl extends RefJavaUtil{ } } } -} \ No newline at end of file +} diff --git a/java/java-tests/testData/inspection/deadCode/classLiteralRef/expected.xml b/java/java-tests/testData/inspection/deadCode/classLiteralRef/expected.xml new file mode 100644 index 000000000000..bdafc52f107c --- /dev/null +++ b/java/java-tests/testData/inspection/deadCode/classLiteralRef/expected.xml @@ -0,0 +1,4 @@ + + + + diff --git a/java/java-tests/testData/inspection/deadCode/classLiteralRef/src/Test.java b/java/java-tests/testData/inspection/deadCode/classLiteralRef/src/Test.java new file mode 100644 index 000000000000..13500191cfe2 --- /dev/null +++ b/java/java-tests/testData/inspection/deadCode/classLiteralRef/src/Test.java @@ -0,0 +1,12 @@ +import java.lang.Class; +import java.lang.String; + +public class Test { + public static void main(String[] args) { + Test.class.getDeclaredConstructor(String.class).newInstance("Foo"); + } + + public Test(String param) { + System.out.println("This is used!"); + } +} diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/UnusedDeclarationTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedDeclarationTest.java index 5dcd702f8835..aa8049be425e 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/UnusedDeclarationTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedDeclarationTest.java @@ -184,4 +184,8 @@ public class UnusedDeclarationTest extends InspectionTestCase { public void testAbstractClassWithSerializableSubclasses() throws Exception { doTest(); } + + public void testclassLiteralRef() throws Exception { + doTest(); + } } From 3ca613ed1252f174cddcd8d908fd3f46e9b07db6 Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Tue, 17 Apr 2012 17:46:08 +0400 Subject: [PATCH 20/44] IDEA-84752 (Import module from external model (maven) doesn't work if selected maven module is in ignored list) --- .../SelectImportedProjectsStep.java | 11 ++++++++++- .../wizards/MavenProjectImportProvider.java | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/java/idea-ui/src/com/intellij/projectImport/SelectImportedProjectsStep.java b/java/idea-ui/src/com/intellij/projectImport/SelectImportedProjectsStep.java index bc10db18f06a..6d9e22b1b3b6 100644 --- a/java/idea-ui/src/com/intellij/projectImport/SelectImportedProjectsStep.java +++ b/java/idea-ui/src/com/intellij/projectImport/SelectImportedProjectsStep.java @@ -71,11 +71,20 @@ public abstract class SelectImportedProjectsStep extends ProjectImportWizardS return panel; } + protected boolean isElementEnabled(T element) { + return true; + } + public void updateStep() { fileChooser.clear(); for (T element : getContext().getList()) { - fileChooser.addElement(element, getContext().isMarked(element)); + boolean isEnabled = isElementEnabled(element); + fileChooser.addElement(element, isEnabled && getContext().isMarked(element)); + if (!isEnabled) { + fileChooser.disableElement(element); + } } + fileChooser.setBorder(IdeBorderFactory.createTitledBorder( IdeBundle.message("project.import.select.title", getContext().getName()), false)); openModuleSettingsCheckBox.setSelected(getBuilder().isOpenProjectSettingsAfter()); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectImportProvider.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectImportProvider.java index e38981093af8..a068595e4851 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectImportProvider.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectImportProvider.java @@ -23,11 +23,13 @@ package org.jetbrains.idea.maven.wizards; import com.intellij.ide.util.projectWizard.ModuleWizardStep; import com.intellij.ide.util.projectWizard.ProjectWizardStepFactory; import com.intellij.ide.util.projectWizard.WizardContext; +import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.projectImport.ProjectImportProvider; import com.intellij.projectImport.SelectImportedProjectsStep; import org.jetbrains.idea.maven.project.MavenProject; +import org.jetbrains.idea.maven.project.MavenProjectsManager; import java.io.File; @@ -36,7 +38,7 @@ public class MavenProjectImportProvider extends ProjectImportProvider { super(builder); } - public ModuleWizardStep[] createSteps(WizardContext wizardContext) { + public ModuleWizardStep[] createSteps(final WizardContext wizardContext) { final ProjectWizardStepFactory stepFactory = ProjectWizardStepFactory.getInstance(); return new ModuleWizardStep[]{new MavenProjectImportStep(wizardContext), new SelectProfilesStep(wizardContext), new SelectImportedProjectsStep(wizardContext) { @@ -50,9 +52,22 @@ public class MavenProjectImportProvider extends ProjectImportProvider { stringBuilder.append(" [").append(relPath).append("]"); } } + + if (!isElementEnabled(project)) { + stringBuilder.append(" (project is ignored. See Settings -> Maven -> Ignored Files)"); + } + return stringBuilder.toString(); } + @Override + protected boolean isElementEnabled(MavenProject mavenProject) { + Project project = wizardContext.getProject(); + if (project == null) return true; + + return !MavenProjectsManager.getInstance(project).isIgnored(mavenProject); + } + public void updateDataModel() { super.updateDataModel(); getWizardContext().setProjectName(((MavenProjectBuilder)getBuilder()).getSuggestedProjectName()); From ad3b8da4bf9bc13155cb8cf979fe3fb6a67a2746 Mon Sep 17 00:00:00 2001 From: Vassiliy Kudryashov Date: Tue, 17 Apr 2012 15:47:25 +0400 Subject: [PATCH 21/44] miglayout license --- build/scripts/libLicenses.gant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant index d0fa5bde641c..29b981ef038e 100644 --- a/build/scripts/libLicenses.gant +++ b/build/scripts/libLicenses.gant @@ -206,7 +206,7 @@ libraryLicense(name: "Maven3", libraryNames: ["Maven3", "maven-dependency-tree-1 libraryLicense(name: "markdownj", attachedTo: "tasks-core", version: "", license: "BSD", url: "http://markdownj.org/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php") libraryLicense(name: "mercurial_prompthooks", attachedTo: "hg4idea", version: "", license: "GPLv2 (used as hg extension called from hg executable)", url: "https://github.com/willemv/mercurial_prompthooks", licenseUrl: "https://github.com/willemv/mercurial_prompthooks/blob/master/LICENSE.txt") libraryLicense(name: "Microba", libraryName: "microba", version: "0.4.2", license: "BSD", url: "http://microba.sourceforge.net/", licenseUrl: "http://microba.sourceforge.net/license.txt") -libraryLicense(name: "MigLayout", libraryName: "miglayout-swing.jar", version: "3.7.1", license: "BSD", url: "http://www.miglayout.com/", licenseUrl: "http://www.miglayout.com/mavensite/license.html") +libraryLicense(name: "MigLayout", libraryName: "miglayout-swing", version: "3.7.1", license: "BSD", url: "http://www.miglayout.com/", licenseUrl: "http://www.miglayout.com/mavensite/license.html") libraryLicense(name: "NanoXML", version: "2.2.3", license: "zlib/libpng", url: "http://nanoxml.cyberelf.be/", licenseUrl: "http://devkix.com/nanoxml.php") libraryLicense(name: "nekohtml", libraryName: "nekohtml", version: "1.9.14", license: "Apache 2.0", url: "http://nekohtml.sourceforge.net/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0.txt") libraryLicense(name: "Eclipse JDT Core", libraryName: "Eclipse", version: "3.3", license: "CPL 1.0", url: "http://www.eclipse.org/jdt/core/index.php") From 41c4d586c48b40a0f871944934d5504fcf8b0dcb Mon Sep 17 00:00:00 2001 From: Vassiliy Kudryashov Date: Tue, 17 Apr 2012 18:02:31 +0400 Subject: [PATCH 22/44] Fix "Make before launch" --- .../execution/impl/RunManagerImpl.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java index 0061cdad34f7..9d1f528231e4 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java @@ -439,7 +439,17 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable, if (!(settings.getConfiguration() instanceof UnknownRunConfiguration)) { final List tasks = getBeforeRunTasks(settings.getConfiguration()); final Element methodsElement = new Element(METHOD); + Map,BeforeRunTask> templateTasks = null; + if (!settings.isTemplate()) { + List beforeRunTasks = getBeforeRunTasks(getConfigurationTemplate(settings.getFactory()).getConfiguration()); + templateTasks = new HashMap, BeforeRunTask>(); + for (BeforeRunTask task : beforeRunTasks) { + templateTasks.put(task.getProviderId(), task); + } + } for (BeforeRunTask task : tasks) { + if (templateTasks != null && task.equals(templateTasks.get(task.getProviderId()))) + continue; // not neccesary saving if the task is the same as template final Element child = new Element(OPTION); child.setAttribute(NAME_ATTR, task.getProviderId().toString()); task.writeExternal(child); @@ -859,7 +869,20 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable, } public final void setBeforeRunTasks(final RunConfiguration runConfiguration, List tasks) { - myConfigurationToBeforeTasksMap.put(runConfiguration, tasks); + List templates = getBeforeRunTasks(runConfiguration);//here may be some disabled templates + Set> idsToSet = new HashSet>(); + List result = new ArrayList(tasks); + for (BeforeRunTask task : tasks) { + idsToSet.add(task.getProviderId()); + } + int i = 0; + for (BeforeRunTask template : templates) { + if (!idsToSet.contains(template.getProviderId())) { + result.add(i, template); + i++; + } + } + myConfigurationToBeforeTasksMap.put(runConfiguration, result); fireBeforeRunTasksUpdated(); } From 4ed975f25511d9628bfaeeb8761bfb6cfc6f00a7 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 17 Apr 2012 16:22:38 +0200 Subject: [PATCH 23/44] offline inspections: iterate by project once to export all results --- .../deadCode/DummyEntryPointsTool.java | 4 +- .../deadCode/UnusedDeclarationInspection.java | 70 +++++++++---------- .../ex/CommonInspectionToolWrapper.java | 5 +- .../ex/DescriptorProviderInspection.java | 22 +++--- .../ex/GlobalInspectionContextImpl.java | 48 +++++++++---- .../codeInspection/ex/InspectionTool.java | 16 +++-- 6 files changed, 94 insertions(+), 71 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java index 94c0fc425da8..ed7445199c3c 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java @@ -47,7 +47,9 @@ public class DummyEntryPointsTool extends FilteringInspectionTool { public void runInspection(@NotNull AnalysisScope scope, @NotNull final InspectionManager manager) {} - public void exportResults(@NotNull Element parentNode) {} + @Override + public void exportResults(@NotNull Element parentNode, RefEntity refEntity) { + } @NotNull public JobDescriptor[] getJobDescriptors(GlobalInspectionContext globalInspectionContext) { diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java index d3ffbc9bb33b..6968e8ff5f9f 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java @@ -631,45 +631,43 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool { return myComposer; } - public void exportResults(@NotNull final Element parentNode) { + @Override + public void exportResults(@NotNull final Element parentNode, RefEntity refEntity) { + if (!(refEntity instanceof RefJavaElement)) return; final WeakUnreferencedFilter filter = new WeakUnreferencedFilter(this); - getRefManager().iterate(new RefJavaVisitor() { - @Override public void visitElement(RefEntity refEntity) { - if (!(refEntity instanceof RefJavaElement)) return; - if (!getIgnoredRefElements().contains(refEntity) && filter.accepts((RefJavaElement)refEntity)) { - if (refEntity instanceof RefImplicitConstructor) refEntity = ((RefImplicitConstructor)refEntity).getOwnerClass(); - Element element = refEntity.getRefManager().export(refEntity, parentNode, -1); - @NonNls Element problemClassElement = new Element(InspectionsBundle.message("inspection.export.results.problem.element.tag")); + if (!getIgnoredRefElements().contains(refEntity) && filter.accepts((RefJavaElement)refEntity)) { + if (refEntity instanceof RefImplicitConstructor) refEntity = ((RefImplicitConstructor)refEntity).getOwnerClass(); + Element element = refEntity.getRefManager().export(refEntity, parentNode, -1); + @NonNls Element problemClassElement = new Element(InspectionsBundle.message("inspection.export.results.problem.element.tag")); - if (refEntity instanceof RefElement) { - final RefElement refElement = (RefElement)refEntity; - final HighlightSeverity severity = getCurrentSeverity(refElement); - final String attributeKey = getTextAttributeKey(refElement.getElement().getProject(), severity, ProblemHighlightType.LIKE_UNUSED_SYMBOL); - problemClassElement.setAttribute("severity", severity.myName); - problemClassElement.setAttribute("attribute_key", attributeKey); - } - - problemClassElement.addContent(InspectionsBundle.message("inspection.export.results.dead.code")); - element.addContent(problemClassElement); - - @NonNls Element hintsElement = new Element("hints"); - - for (String hint : HINTS) { - @NonNls Element hintElement = new Element("hint"); - hintElement.setAttribute("value", hint); - hintsElement.addContent(hintElement); - } - element.addContent(hintsElement); - - - Element descriptionElement = new Element(InspectionsBundle.message("inspection.export.results.description.tag")); - StringBuffer buf = new StringBuffer(); - DeadHTMLComposer.appendProblemSynopsis((RefElement)refEntity, buf); - descriptionElement.addContent(buf.toString()); - element.addContent(descriptionElement); - } + if (refEntity instanceof RefElement) { + final RefElement refElement = (RefElement)refEntity; + final HighlightSeverity severity = getCurrentSeverity(refElement); + final String attributeKey = + getTextAttributeKey(refElement.getElement().getProject(), severity, ProblemHighlightType.LIKE_UNUSED_SYMBOL); + problemClassElement.setAttribute("severity", severity.myName); + problemClassElement.setAttribute("attribute_key", attributeKey); } - }); + + problemClassElement.addContent(InspectionsBundle.message("inspection.export.results.dead.code")); + element.addContent(problemClassElement); + + @NonNls Element hintsElement = new Element("hints"); + + for (String hint : HINTS) { + @NonNls Element hintElement = new Element("hint"); + hintElement.setAttribute("value", hint); + hintsElement.addContent(hintElement); + } + element.addContent(hintsElement); + + + Element descriptionElement = new Element(InspectionsBundle.message("inspection.export.results.description.tag")); + StringBuffer buf = new StringBuffer(); + DeadHTMLComposer.appendProblemSynopsis((RefElement)refEntity, buf); + descriptionElement.addContent(buf.toString()); + element.addContent(descriptionElement); + } } public QuickFixAction[] getQuickFixes(final RefEntity[] refElements) { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/CommonInspectionToolWrapper.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/CommonInspectionToolWrapper.java index 3858734b488c..60013c809bf1 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/CommonInspectionToolWrapper.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/CommonInspectionToolWrapper.java @@ -20,6 +20,7 @@ import com.intellij.codeInspection.GlobalInspectionContext; import com.intellij.codeInspection.InspectionEP; import com.intellij.codeInspection.InspectionManager; import com.intellij.codeInspection.reference.RefEntity; +import com.intellij.codeInspection.reference.RefVisitor; import com.intellij.codeInspection.ui.InspectionNode; import com.intellij.codeInspection.ui.InspectionTreeNode; import org.jdom.Element; @@ -111,7 +112,7 @@ public class CommonInspectionToolWrapper extends InspectionToolWrapper\n"); } for (Object o : list) { @@ -263,19 +262,16 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem return myComposer; } - public void exportResults(@NotNull final Element parentNode) { - getRefManager().iterate(new RefVisitor() { - @Override public void visitElement(final RefEntity refEntity) { - synchronized (lock) { - if (getProblemElements().containsKey(refEntity)) { - CommonProblemDescriptor[] descriptions = getDescriptions(refEntity); - if (descriptions != null) { - exportResults(descriptions, refEntity, parentNode); - } - } + @Override + public void exportResults(final @NotNull Element parentNode, RefEntity refEntity) { + synchronized (lock) { + if (getProblemElements().containsKey(refEntity)) { + CommonProblemDescriptor[] descriptions = getDescriptions(refEntity); + if (descriptions != null) { + exportResults(descriptions, refEntity, parentNode); } } - }); + } } private void exportResults(@NotNull final CommonProblemDescriptor[] descriptions, final RefEntity refEntity, final Element parentNode) { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java index 872844b78bbf..18d9ef0bc84e 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -105,6 +105,7 @@ public class GlobalInspectionContextImpl extends UserDataHolderBase implements G private final Map myTools = new THashMap(); private AnalysisUIOptions myUIOptions; + @NonNls static final String LOCAL_TOOL_ATTRIBUTE = "is_local_tool"; public GlobalInspectionContextImpl(Project project, NotNullLazyValue contentManager) { myProject = project; @@ -296,44 +297,63 @@ public class GlobalInspectionContextImpl extends UserDataHolderBase implements G public void run() { performInspectionsWithProgress(scope, manager); @NonNls final String ext = ".xml"; + final Map globalTools = new HashMap(); for (Map.Entry stringSetEntry : myTools.entrySet()) { - final Element root = new Element(InspectionsBundle.message("inspection.problems")); - final Document doc = new Document(root); final Tools sameTools = stringSetEntry.getValue(); boolean hasProblems = false; - boolean isLocalTool = false; String toolName = stringSetEntry.getKey(); if (sameTools != null) { for (ScopeToolState toolDescr : sameTools.getTools()) { final InspectionTool tool = (InspectionTool)toolDescr.getTool(); if (tool instanceof LocalInspectionToolWrapper) { hasProblems = new File(outputPath, toolName + ext).exists(); - isLocalTool = true; } else { tool.updateContent(); if (tool.hasReportedProblems()) { - hasProblems = true; - tool.exportResults(root); + final Element root = new Element(InspectionsBundle.message("inspection.problems")); + globalTools.put(root, sameTools); + LOG.assertTrue(!hasProblems, toolName); + break; } } } } if (!hasProblems) continue; - @NonNls final String isLocalToolAttribute = "is_local_tool"; - root.setAttribute(isLocalToolAttribute, String.valueOf(isLocalTool)); try { new File(outputPath).mkdirs(); final File file = new File(outputPath, toolName + ext); inspectionsResults.add(file); - if (isLocalTool) { - FileUtil.writeToFile(file, ("").getBytes("UTF-8"), true); - } - else { - PathMacroManager.getInstance(getProject()).collapsePaths(doc.getRootElement()); - JDOMUtil.writeDocument(doc, file, "\n"); + FileUtil.writeToFile(file, ("").getBytes("UTF-8"), true); + } + catch (IOException e) { + LOG.error(e); + } + } + + getRefManager().iterate(new RefVisitor() { + @Override + public void visitElement(final RefEntity refEntity) { + for (Element element : globalTools.keySet()) { + final Tools tools = globalTools.get(element); + for (ScopeToolState state : tools.getTools()) { + ((InspectionTool)state.getTool()).exportResults(element, refEntity); + } } } + }); + + for (Element element : globalTools.keySet()) { + final String toolName = globalTools.get(element).getShortName(); + element.setAttribute(LOCAL_TOOL_ATTRIBUTE, Boolean.toString(false)); + final Document doc = new Document(element); + PathMacroManager.getInstance(getProject()).collapsePaths(doc.getRootElement()); + try { + new File(outputPath).mkdirs(); + final File file = new File(outputPath, toolName + ext); + inspectionsResults.add(file); + JDOMUtil.writeDocument(doc, file, "\n"); + } catch (IOException e) { LOG.error(e); } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionTool.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionTool.java index 279ef0b60f33..e9d0aa00349d 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionTool.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionTool.java @@ -29,10 +29,7 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfoType; import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInspection.*; -import com.intellij.codeInspection.reference.RefElement; -import com.intellij.codeInspection.reference.RefEntity; -import com.intellij.codeInspection.reference.RefManager; -import com.intellij.codeInspection.reference.RefModule; +import com.intellij.codeInspection.reference.*; import com.intellij.codeInspection.ui.InspectionNode; import com.intellij.codeInspection.ui.InspectionTreeNode; import com.intellij.lang.annotation.HighlightSeverity; @@ -69,7 +66,16 @@ public abstract class InspectionTool extends InspectionProfileEntry { public abstract void runInspection(@NotNull AnalysisScope scope, @NotNull InspectionManager manager); - public abstract void exportResults(@NotNull Element parentNode); + public void exportResults(@NotNull final Element parentNode) { + getRefManager().iterate(new RefVisitor(){ + @Override + public void visitElement(RefEntity elem) { + exportResults(parentNode, elem); + } + }); + } + + public abstract void exportResults(@NotNull Element parentNode, RefEntity refEntity); public abstract boolean isGraphNeeded(); @Nullable From 33e078b84976e761e74af376b6f49f73507df52b Mon Sep 17 00:00:00 2001 From: Vassiliy Kudryashov Date: Tue, 17 Apr 2012 18:44:12 +0400 Subject: [PATCH 24/44] Fix tests --- .../src/com/intellij/execution/impl/RunManagerImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java index 9d1f528231e4..ca49a0227f8e 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java @@ -803,7 +803,11 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable, @NotNull @Override public List getBeforeRunTasks(RunConfiguration settings, Key taskProviderID) { - List tasks = getBeforeRunTasks(settings); + List tasks = myConfigurationToBeforeTasksMap.get(settings); + if (tasks == null) { + tasks = getBeforeRunTasks(settings); + myConfigurationToBeforeTasksMap.put(settings, tasks); + } List result = new ArrayList(); for (BeforeRunTask task : tasks) { if (task.getProviderId() == taskProviderID) From 52b9f29ed4996f2104b7dee15a851cbe9f943e4f Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Tue, 17 Apr 2012 18:45:39 +0400 Subject: [PATCH 25/44] Fix Grails toolwindow icon --- plugins/groovy/src/META-INF/plugin.xml | 2 +- .../org/jetbrains/plugins/groovy/griffon/GriffonFramework.java | 2 +- .../plugins/groovy/griffon/GriffonToolWindowFactory.java | 2 +- .../plugins/groovy/mvc/MvcModuleStructureSynchronizer.java | 1 + .../plugins/groovy/mvc/projectView/MvcToolWindowDescriptor.java | 1 - 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index 6c859cfc3554..a271e68e9f9c 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -1012,7 +1012,7 @@ - diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java index 7c96df71a060..37b103725224 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java @@ -55,7 +55,7 @@ import java.util.Map; */ public class GriffonFramework extends MvcFramework { public static final Icon GRIFFON_ICON = IconLoader.getIcon("/icons/griffon/griffon.png"); - public static final Icon GRIFFON_TOOLWINDOW_ICON = IconLoader.getIcon("/icons/griffon/griffonToolWindow.png"); + @NonNls private static final String GRIFFON_COMMON_PLUGINS = "-griffonPlugins"; private static final String GLOBAL_PLUGINS_MODULE_NAME = "GriffonGlobalPlugins"; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonToolWindowFactory.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonToolWindowFactory.java index c2f7e1ae647d..d7c0ffa84c13 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonToolWindowFactory.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonToolWindowFactory.java @@ -92,7 +92,7 @@ public class GriffonToolWindowFactory extends MvcToolWindowDescriptor { @Override public Icon getModuleNodeIcon() { - return GriffonFramework.GRIFFON_TOOLWINDOW_ICON; + return GriffonFramework.GRIFFON_ICON; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureSynchronizer.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureSynchronizer.java index 5043085dee36..c0b2fe7a0f32 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureSynchronizer.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureSynchronizer.java @@ -422,6 +422,7 @@ public class MvcModuleStructureSynchronizer extends AbstractProjectComponent { if (shouldShow && toolWindow == null) { toolWindow = toolWindowManager.registerToolWindow(id, true, ToolWindowAnchor.LEFT, myProject, true); + toolWindow.setIcon(IconLoader.getIcon(ep.icon)); descriptor.createToolWindowContent(myProject, toolWindow); } else if (!shouldShow && toolWindow != null) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/projectView/MvcToolWindowDescriptor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/projectView/MvcToolWindowDescriptor.java index 9f9e4d8bbd52..ca1d2e31920b 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/projectView/MvcToolWindowDescriptor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/projectView/MvcToolWindowDescriptor.java @@ -51,7 +51,6 @@ public abstract class MvcToolWindowDescriptor implements ToolWindowFactory, Cond } public void createToolWindowContent(Project project, ToolWindow toolWindow) { - toolWindow.setIcon(myFramework.getIcon()); toolWindow.setAvailable(true, null); toolWindow.setToHideOnEmptyContent(true); toolWindow.setTitle(myFramework.getDisplayName()); From 2c8c562e02731e840d922381561ca82106101351 Mon Sep 17 00:00:00 2001 From: Eugene Kudelevsky Date: Tue, 17 Apr 2012 18:57:14 +0400 Subject: [PATCH 26/44] show warnings for app modules only --- .../src/org/jetbrains/android/compiler/AndroidAptCompiler.java | 2 +- .../org/jetbrains/android/compiler/AndroidAutogenerator.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/android/src/org/jetbrains/android/compiler/AndroidAptCompiler.java b/plugins/android/src/org/jetbrains/android/compiler/AndroidAptCompiler.java index 2e0d4d54db6c..6349f4880e33 100644 --- a/plugins/android/src/org/jetbrains/android/compiler/AndroidAptCompiler.java +++ b/plugins/android/src/org/jetbrains/android/compiler/AndroidAptCompiler.java @@ -263,7 +263,7 @@ public class AndroidAptCompiler implements SourceGeneratingCompiler { final String[] libPackages = getLibPackages(module, packageName); final Module circularDepLibWithSamePackage = AndroidCompileUtil.findCircularDependencyOnLibraryWithSamePackage(facet); - if (circularDepLibWithSamePackage != null) { + if (circularDepLibWithSamePackage != null && !facet.getConfiguration().LIBRARY_PROJECT) { myContext.addMessage(CompilerMessageCategory.WARNING, AndroidBundle.message("android.compilation.warning.circular.app.dependency", packageName, module.getName(), diff --git a/plugins/android/src/org/jetbrains/android/compiler/AndroidAutogenerator.java b/plugins/android/src/org/jetbrains/android/compiler/AndroidAutogenerator.java index 623ade3e0a71..c5d4f05b6c48 100644 --- a/plugins/android/src/org/jetbrains/android/compiler/AndroidAutogenerator.java +++ b/plugins/android/src/org/jetbrains/android/compiler/AndroidAutogenerator.java @@ -163,7 +163,7 @@ public class AndroidAutogenerator { final String manifestFileOsPath = FileUtil.toSystemDependentName(manifestFile.getPath()); final Module circularDepLibWithSamePackage = AndroidCompileUtil.findCircularDependencyOnLibraryWithSamePackage(facet); - if (circularDepLibWithSamePackage != null) { + if (circularDepLibWithSamePackage != null && !facet.getConfiguration().LIBRARY_PROJECT) { context.addMessage(CompilerMessageCategory.WARNING, AndroidBundle.message("android.compilation.warning.circular.app.dependency", packageName, module.getName(), circularDepLibWithSamePackage.getName()), null, -1, -1); From 5e451638c102002aad9ec14075b2d7110e648c74 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 17 Apr 2012 17:23:03 +0200 Subject: [PATCH 27/44] no need to check if clone available when the action is invisible --- .../src/com/intellij/ide/actions/CloneElementAction.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/CloneElementAction.java b/platform/lang-impl/src/com/intellij/ide/actions/CloneElementAction.java index e5d3ac3e9352..8e6a97451901 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/CloneElementAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/CloneElementAction.java @@ -39,13 +39,13 @@ public class CloneElementAction extends CopyElementAction { } protected void updateForToolWindow(String id, DataContext dataContext,Presentation presentation) { + if (!ToolWindowId.COMMANDER.equals(id)) { + presentation.setVisible(false); + return; + } // work only with single selection PsiElement[] elements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(dataContext); presentation.setEnabled(elements != null && elements.length == 1 && CopyHandler.canClone(elements)); presentation.setVisible(true); - - if (!ToolWindowId.COMMANDER.equals(id)) { - presentation.setVisible(false); - } } } From 4da6b834fe55940c754a4cf5055d3eb5a43d17b3 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 17 Apr 2012 17:23:35 +0200 Subject: [PATCH 28/44] distinguish clone update checks (IDEA-84616) --- .../src/com/intellij/refactoring/copy/CopyHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/refactoring/copy/CopyHandler.java b/platform/lang-impl/src/com/intellij/refactoring/copy/CopyHandler.java index 211ab529dd36..a8b32d0cd14a 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/copy/CopyHandler.java +++ b/platform/lang-impl/src/com/intellij/refactoring/copy/CopyHandler.java @@ -62,7 +62,7 @@ public class CopyHandler { if (elements.length > 0) { final CopyHandlerDelegate[] copyHandlers = Extensions.getExtensions(CopyHandlerDelegate.EP_NAME); for (CopyHandlerDelegate delegate : copyHandlers) { - if (delegate.canCopy(elements)) { + if (delegate instanceof CopyHandlerDelegateBase ? ((CopyHandlerDelegateBase)delegate).canCopy(elements, true) : delegate.canCopy(elements)) { if (delegate instanceof CopyHandlerDelegateBase && ((CopyHandlerDelegateBase)delegate).forbidToClone(elements, true)){ return false; } From 59b8a834d4d07abf83fabc6a450f4215a8ea0ae1 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Tue, 17 Apr 2012 19:53:30 +0400 Subject: [PATCH 29/44] IDEA-84080 Ability to execute Mac app bundles as external tools --- .../lang-impl/src/com/intellij/tools/Tool.java | 11 ++++++++++- .../src/com/intellij/tools/ToolEditorDialog.java | 4 ++-- .../fileChooser/FileChooserDescriptor.java | 2 +- .../FileChooserDescriptorFactory.java | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/tools/Tool.java b/platform/lang-impl/src/com/intellij/tools/Tool.java index 1ad5476014d3..cfa2d8426c74 100644 --- a/platform/lang-impl/src/com/intellij/tools/Tool.java +++ b/platform/lang-impl/src/com/intellij/tools/Tool.java @@ -34,6 +34,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import org.jetbrains.annotations.NonNls; +import java.io.File; import java.util.ArrayList; public class Tool implements SchemeElement { @@ -300,7 +301,15 @@ public class Tool implements SchemeElement { commandLine.setWorkDirectory(MacroManager.getInstance().expandMacrosInString(workingDir, false, dataContext)); exePath = MacroManager.getInstance().expandMacrosInString(exePath, false, dataContext); if (exePath == null) return null; - commandLine.setExePath(exePath); + + File exeFile = new File(exePath); + if (exeFile.isDirectory() && exeFile.getName().endsWith(".app")) { + commandLine.setExePath("open"); + commandLine.getParametersList().prependAll("-a", exePath); + } + else { + commandLine.setExePath(exePath); + } } catch (Macro.ExecutionCancelledException e) { return null; diff --git a/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java b/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java index 7c4055402403..e929f1b7fad9 100644 --- a/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java +++ b/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java @@ -196,7 +196,7 @@ public class ToolEditorDialog extends DialogWrapper { browseCommandButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { - FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); + FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrExecutableAppDescriptor(); VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); if (file != null) { myTfCommand.setText(file.getPresentableUrl()); @@ -463,4 +463,4 @@ public class ToolEditorDialog extends DialogWrapper { if (s.length() == 0) return null; return s.replace('/', File.separatorChar); } -} \ No newline at end of file +} diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptor.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptor.java index d69b4c68c2bb..ea6067421823 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptor.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptor.java @@ -206,7 +206,7 @@ public class FileChooserDescriptor implements Cloneable { @Nullable public final VirtualFile getFileToSelect(VirtualFile file) { - if (file.isDirectory() && myChooseFolders) { + if (file.isDirectory() && (myChooseFolders || isFileSelectable(file))) { return file; } boolean isJar = file.getFileType() == FileTypes.ARCHIVE; diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorFactory.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorFactory.java index 2696d8904ceb..057ca54e3b4b 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorFactory.java @@ -16,6 +16,7 @@ package com.intellij.openapi.fileChooser; import com.intellij.openapi.fileTypes.FileType; +import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.UIBundle; @@ -39,6 +40,21 @@ public class FileChooserDescriptorFactory { return new FileChooserDescriptor(true, false, false, false, false, false); } + public static FileChooserDescriptor createSingleFileOrExecutableAppDescriptor() { + return new FileChooserDescriptor(true, false, false, false, false, false) { + @Override + public boolean isFileSelectable(VirtualFile file) { + if (super.isFileSelectable(file)) return true; + + if (SystemInfo.isMac && file.isDirectory() && "app".equals(file.getExtension())) { + return true; + } + + return false; + } + }; + } + public static FileChooserDescriptor createSingleLocalFileDescriptor() { return new FileChooserDescriptor(true, true, true, true, false, false); } From d092c59e00c8a2a50c44120493817cfedef52271 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 17 Apr 2012 17:59:38 +0200 Subject: [PATCH 30/44] remove usages of disablecounts option --- bin/scripts/unix/idea.sh | 2 +- build/scripts/utils.gant | 6 +++--- .../plugins/groovy/compiler/GroovyCompilerBase.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/scripts/unix/idea.sh b/bin/scripts/unix/idea.sh index b818b17e501b..7a7601646348 100755 --- a/bin/scripts/unix/idea.sh +++ b/bin/scripts/unix/idea.sh @@ -145,7 +145,7 @@ if [ "$IS_EAP" = "true" ]; then OS_NAME=`echo $OS_TYPE | "$TR" '[:upper:]' '[:lower:]'` AGENT_LIB="yjpagent-$OS_NAME$BITS" if [ -r "$IDE_BIN_HOME/lib$AGENT_LIB.so" ]; then - AGENT="-agentlib:$AGENT_LIB=disablej2ee,disablecounts,disablealloc,sessionname=@@system_selector@@" + AGENT="-agentlib:$AGENT_LIB=disablej2ee,disablealloc,sessionname=@@system_selector@@" fi fi diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant index 09ebb86f8101..0913128f69f4 100644 --- a/build/scripts/utils.gant +++ b/build/scripts/utils.gant @@ -60,10 +60,10 @@ binding.setVariable("vmOptions", { "$common_vmoptions ${isEap() ? '-XX:+HeapDump binding.setVariable("vmOptions32", { "$mem32 ${vmOptions()}".trim() }) binding.setVariable("vmOptions64", { "$mem64 ${vmOptions()}".trim() }) binding.setVariable("vmOptions32yjp", { String systemSelector -> - "${vmOptions32()} -agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=$systemSelector".trim() + "${vmOptions32()} -agentlib:yjpagent=disablej2ee,disablealloc,sessionname=$systemSelector".trim() }) binding.setVariable("vmOptions64yjp", { String systemSelector -> - "${vmOptions64()} -agentlib:yjpagent64=disablej2ee,disablecounts,disablealloc,sessionname=$systemSelector".trim() + "${vmOptions64()} -agentlib:yjpagent64=disablej2ee,disablealloc,sessionname=$systemSelector".trim() }) binding.setVariable("isDefined", {String key -> @@ -252,7 +252,7 @@ binding.setVariable("layoutMacApp", { String path, String ch, Map args -> String vmOptions = "${vmOptions()} -Xverify:none" if (isEap() && !args.mac_no_yjp) { - vmOptions += " -agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=${args.system_selector}" + vmOptions += " -agentlib:yjpagent=disablej2ee,disablealloc,sessionname=${args.system_selector}" } String version = isEap() ? "EAP $args.buildNumber" : "${p("component.version.major")}.${p("component.version.minor")}" diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java index d546b64d0ebc..c76fad7a4e3c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java @@ -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. @@ -143,7 +143,7 @@ public abstract class GroovyCompilerBase implements TranslatingCompiler { if (profileGroovyc) { parameters.getVMParametersList().defineProperty("java.library.path", PathManager.getBinPath()); parameters.getVMParametersList().defineProperty("profile.groovy.compiler", "true"); - parameters.getVMParametersList().add("-agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=GroovyCompiler"); + parameters.getVMParametersList().add("-agentlib:yjpagent=disablej2ee,disablealloc,sessionname=GroovyCompiler"); classPathBuilder.add(PathManager.findFileInLibDirectory("yjp-controller-api-redist.jar").getAbsolutePath()); } From 8d2f52a9c157ab33f4457b4fbfb275f4b533a505 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 17 Apr 2012 18:03:14 +0200 Subject: [PATCH 31/44] another attempt to fix IDEA-74871 (Next/Previous Project Window action doesn't move focus to visible window) --- .../openapi/wm/impl/ProjectWindowAction.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java index 250ec9cda7f2..38a8a481a6ba 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java @@ -15,16 +15,19 @@ */ package com.intellij.openapi.wm.impl; -import com.intellij.ide.impl.ProjectUtil; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; +import com.intellij.openapi.wm.WindowManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import javax.swing.*; +import java.awt.*; + /** * @ author Bas Leijdekkers * This class is programmatically instantiated and registered when opening and closing projects @@ -115,7 +118,15 @@ public class ProjectWindowAction extends ToggleAction implements DumbAware { if (project == null) { return; } - ProjectUtil.focusProjectWindow(project, true); + final JFrame projectFrame = WindowManager.getInstance().getFrame(project); + final int frameState = projectFrame.getExtendedState(); + if ((frameState & Frame.ICONIFIED) == Frame.ICONIFIED) { + // restore the frame if it is minimized + projectFrame.setExtendedState(frameState ^ Frame.ICONIFIED); + } + projectFrame.toFront(); + projectFrame.requestFocus(); + //ProjectUtil.focusProjectWindow(project, true); } @Override From 201c6db57b0be1973d769395e0d635047753b7d2 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Tue, 17 Apr 2012 20:07:29 +0400 Subject: [PATCH 32/44] Use native choosers in tool editor --- .../com/intellij/tools/ToolEditorDialog.java | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java b/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java index e929f1b7fad9..35905c7b2688 100644 --- a/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java +++ b/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java @@ -21,9 +21,10 @@ import com.intellij.ide.macro.MacroManager; import com.intellij.ide.macro.MacrosDialog; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.PlatformDataKeys; -import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; +import com.intellij.openapi.fileChooser.FileChooserFactory; +import com.intellij.openapi.fileChooser.PathChooserDialog; import com.intellij.openapi.help.HelpManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.ComboBox; @@ -34,6 +35,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.DocumentAdapter; import com.intellij.ui.IdeBorderFactory; +import com.intellij.util.Consumer; import javax.swing.*; import javax.swing.event.DocumentEvent; @@ -42,6 +44,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; +import java.util.List; public class ToolEditorDialog extends DialogWrapper { private final JTextField myNameField = new JTextField(); @@ -179,7 +182,7 @@ public class ToolEditorDialog extends DialogWrapper { } private JPanel createCommandPane() { - JPanel pane = new JPanel(new GridBagLayout()); + final JPanel pane = new JPanel(new GridBagLayout()); pane.setBorder(IdeBorderFactory.createTitledBorder(ToolsBundle.message("tools.tool.group"), true)); GridBagConstraints constr; @@ -197,17 +200,23 @@ public class ToolEditorDialog extends DialogWrapper { new ActionListener() { public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrExecutableAppDescriptor(); - VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); - if (file != null) { - myTfCommand.setText(file.getPresentableUrl()); - String workingDirectory = myTfCommandWorkingDirectory.getText(); - if (workingDirectory == null || workingDirectory.length() == 0){ - VirtualFile parent = file.getParent(); - if (parent != null && parent.isDirectory()) { - myTfCommandWorkingDirectory.setText(parent.getPresentableUrl()); + PathChooserDialog chooser = FileChooserFactory.getInstance().createPathChooser(descriptor, myProject, pane); + chooser.choose(null, new Consumer>() { + @Override + public void consume(List files) { + VirtualFile file = files.size() > 0 ? files.get(0) : null; + if (file != null) { + myTfCommand.setText(file.getPresentableUrl()); + String workingDirectory = myTfCommandWorkingDirectory.getText(); + if (workingDirectory == null || workingDirectory.length() == 0){ + VirtualFile parent = file.getParent(); + if (parent != null && parent.isDirectory()) { + myTfCommandWorkingDirectory.setText(parent.getPresentableUrl()); + } + } } } - } + }); } } ); @@ -276,10 +285,17 @@ public class ToolEditorDialog extends DialogWrapper { new ActionListener() { public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); - VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); - if (file != null) { - myTfCommandWorkingDirectory.setText(file.getPresentableUrl()); - } + PathChooserDialog chooser = FileChooserFactory.getInstance().createPathChooser(descriptor, myProject, pane); + + chooser.choose(null, new Consumer>() { + @Override + public void consume(List files) { + VirtualFile file = files.size() > 0 ? files.get(0) : null; + if (file != null) { + myTfCommandWorkingDirectory.setText(file.getPresentableUrl()); + } + } + }); } } ); From d284d94c0be616328ebcd5983963ac5dae315a82 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 17 Apr 2012 18:52:46 +0400 Subject: [PATCH 33/44] IDEA-79542 Applying stash fails with cygwin git client Cygwin Git requires stash@{x} identifiers to be passed in quotes. GeneralCommandLine was modified so that it escapes quotes, but that shouldn't be done in this case. 1. Add GitHandler#dontEscapeQuotes to prevent default quotes escaping performed in the GeneralCommandLine. 2. Quote the stash parameter in apply/pop, drop and view actions. 3. Remove the logic from GitUnstashDialog which captured "fatal: Needed a single revision" or "bad revision" messages, because this case is handled by quoting. --- .../src/git4idea/GitRevisionNumber.java | 5 ++ .../src/git4idea/commands/GitHandler.java | 5 ++ .../src/git4idea/ui/GitUnstashDialog.java | 80 ++++++------------- 3 files changed, 36 insertions(+), 54 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitRevisionNumber.java b/plugins/git4idea/src/git4idea/GitRevisionNumber.java index 0b7afd0b3bc9..334e7a069fe7 100644 --- a/plugins/git4idea/src/git4idea/GitRevisionNumber.java +++ b/plugins/git4idea/src/git4idea/GitRevisionNumber.java @@ -223,6 +223,11 @@ public class GitRevisionNumber implements ShortVcsRevisionNumber { h.addParameters("--timestamp", "--max-count=1", rev); h.endOptions(); final String output = h.run(); + return parseRevlistOutputAsRevisionNumber(h, output); + } + + @NotNull + public static GitRevisionNumber parseRevlistOutputAsRevisionNumber(@NotNull GitSimpleHandler h, @NotNull String output) { StringTokenizer tokenizer = new StringTokenizer(output, "\n\r \t", false); Date timestamp = GitUtil.parseTimestampWithNFEReport(tokenizer.nextToken(), h, output); return new GitRevisionNumber(tokenizer.nextToken(), timestamp); diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java index f08a21597a60..c6c33d227d2d 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHandler.java +++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java @@ -728,4 +728,9 @@ public abstract class GitHandler { public String toString() { return myCommandLine.toString(); } + + public void dontEscapeQuotes() { + myCommandLine.putUserData(GeneralCommandLine.DO_NOT_ESCAPE_QUOTES, true); + } + } diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java index 0eeb561ce5a8..ff90fddb6a59 100644 --- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java +++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java @@ -179,21 +179,7 @@ public class GitUnstashDialog extends DialogWrapper { h.unsilence(); } catch (VcsException ex) { - try { - //noinspection HardCodedStringLiteral - if (ex.getMessage().startsWith("fatal: Needed a single revision")) { - h = dropHandler(translateStash(stash.getStash())); - h.run(); - } - else { - h.unsilence(); - throw ex; - } - } - catch (VcsException ex2) { - GitUIUtil.showOperationError(myProject, ex, h.printableCommandLine()); - return; - } + GitUIUtil.showOperationError(myProject, ex, h.printableCommandLine()); } } }); @@ -205,7 +191,8 @@ public class GitUnstashDialog extends DialogWrapper { private GitSimpleHandler dropHandler(String stash) { GitSimpleHandler h = new GitSimpleHandler(myProject, getGitRoot(), GitCommand.STASH); h.setNoSSH(true); - h.addParameters("drop", stash); + h.addParameters("drop"); + addStashParameter(h, stash); return h; } }); @@ -215,23 +202,18 @@ public class GitUnstashDialog extends DialogWrapper { String resolvedStash; String selectedStash = getSelectedStash().getStash(); try { - resolvedStash = GitRevisionNumber.resolve(myProject, root, selectedStash).asString(); + GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.REV_LIST); + h.setNoSSH(true); + h.setSilent(true); + h.addParameters("--timestamp", "--max-count=1"); + addStashParameter(h, selectedStash); + h.endOptions(); + final String output = h.run(); + resolvedStash = GitRevisionNumber.parseRevlistOutputAsRevisionNumber(h, output).asString(); } catch (VcsException ex) { - try { - //noinspection HardCodedStringLiteral - if (ex.getMessage().startsWith("fatal: bad revision 'stash@")) { - selectedStash = translateStash(selectedStash); - resolvedStash = GitRevisionNumber.resolve(myProject, root, selectedStash).asString(); - } - else { - throw ex; - } - } - catch (VcsException ex2) { - GitUIUtil.showOperationError(myProject, ex, "resolving revision"); - return; - } + GitUIUtil.showOperationError(myProject, ex, "resolving revision"); + return; } GitShowAllSubmittedFilesAction.showSubmittedFiles(myProject, resolvedStash, root); } @@ -241,13 +223,16 @@ public class GitUnstashDialog extends DialogWrapper { } /** - * Translate stash name so that { } are escaped. - * - * @param selectedStash a selected stash - * @return translated name + * Adds {@code stash@{x}} parameter to the handler, quotes it if needed. */ - private static String translateStash(String selectedStash) { - return selectedStash.replaceAll("([\\{}])", "\\\\$1"); + private void addStashParameter(@NotNull GitHandler handler, @NotNull String stash) { + if (GitVersionSpecialty.NEEDS_QUOTES_IN_STASH_NAME.existsIn(myVcs.getVersion())) { + handler.addParameters("\"" + stash + "\""); + handler.dontEscapeQuotes(); + } + else { + handler.addParameters(stash); + } } /** @@ -339,10 +324,9 @@ public class GitUnstashDialog extends DialogWrapper { } /** - * @param escaped if true stash name will be escaped * @return unstash handler */ - private GitLineHandler handler(boolean escaped) { + private GitLineHandler handler() { GitLineHandler h = new GitLineHandler(myProject, getGitRoot(), GitCommand.STASH); h.setNoSSH(true); String branch = myBranchTextField.getText(); @@ -356,12 +340,7 @@ public class GitUnstashDialog extends DialogWrapper { h.addParameters("branch", branch); } String selectedStash = getSelectedStash().getStash(); - if (escaped) { - selectedStash = translateStash(selectedStash); - } else if (GitVersionSpecialty.NEEDS_QUOTES_IN_STASH_NAME.existsIn(myVcs.getVersion())) { // else if, because escaping {} also solves the issue - selectedStash = "\"" + selectedStash + "\""; - } - h.addParameters(selectedStash); + addStashParameter(h, selectedStash); return h; } @@ -414,24 +393,17 @@ public class GitUnstashDialog extends DialogWrapper { return; } affectedRoots.add(d.getGitRoot()); - GitLineHandler h = d.handler(false); - final AtomicBoolean needToEscapedBraces = new AtomicBoolean(false); + GitLineHandler h = d.handler(); final AtomicBoolean conflict = new AtomicBoolean(); h.addLineListener(new GitLineHandlerAdapter() { public void onLineAvailable(String line, Key outputType) { - if (line.startsWith("fatal: Needed a single revision")) { - needToEscapedBraces.set(true); - } else if (line.contains("Merge conflict")) { + if (line.contains("Merge conflict")) { conflict.set(true); } } }); int rc = GitHandlerUtil.doSynchronously(h, GitBundle.getString("unstash.unstashing"), h.printableCommandLine(), false); - if (needToEscapedBraces.get()) { - h = d.handler(true); - rc = GitHandlerUtil.doSynchronously(h, GitBundle.getString("unstash.unstashing"), h.printableCommandLine(), false); - } if (conflict.get()) { VirtualFile root = d.getGitRoot(); From a6a0e327f8fe3a84ca7968439753eefa04b0977d Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 17 Apr 2012 19:11:18 +0400 Subject: [PATCH 34/44] IDEA-84746 Show error message in AWT. --- .../git4idea/src/git4idea/ui/GitUnstashDialog.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java index ff90fddb6a59..960621269f9d 100644 --- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java +++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java @@ -18,6 +18,7 @@ package git4idea.ui; import com.intellij.notification.Notification; import com.intellij.notification.NotificationListener; import com.intellij.notification.NotificationType; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressIndicator; @@ -173,13 +174,18 @@ public class GitUnstashDialog extends DialogWrapper { ProgressManager.getInstance().run(new Task.Modal(myProject, "Removing stash " + stash.getStash(), false) { @Override public void run(@NotNull ProgressIndicator indicator) { - GitSimpleHandler h = dropHandler(stash.getStash()); + final GitSimpleHandler h = dropHandler(stash.getStash()); try { h.run(); h.unsilence(); } - catch (VcsException ex) { - GitUIUtil.showOperationError(myProject, ex, h.printableCommandLine()); + catch (final VcsException ex) { + ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override + public void run() { + GitUIUtil.showOperationError(myProject, ex, h.printableCommandLine()); + } + }); } } }); From 20057ee020a8b9c2e76086ffba3b2cefe67913f6 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 17 Apr 2012 19:54:21 +0400 Subject: [PATCH 35/44] IDEA-84728 Git: don't drop stash after resolving conflicts --- .../src/git4idea/stash/GitStashChangesSaver.java | 13 ++----------- .../git4idea/src/git4idea/ui/GitUnstashDialog.java | 5 +---- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java index 3f42006cd2b7..0d551e4d4ee2 100644 --- a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java @@ -79,21 +79,12 @@ public class GitStashChangesSaver extends GitChangesSaver { } public void load() throws VcsException { - Collection conflictedRoots = new ArrayList(); for (VirtualFile root : myStashedRoots) { - boolean conflict = loadRoot(root); - if (conflict) { - conflictedRoots.add(root); - } + loadRoot(root); } boolean conflictsResolved = new UnstashConflictResolver(myProject, myGit, myStashedRoots, myParams).merge(); - if (conflictsResolved) { - LOG.info("load: all conflicts resolved, dropping stash in " + myStashedRoots); - for (VirtualFile root : conflictedRoots) { - GitStashUtils.dropStash(myProject, root); - } - } + LOG.info("load: conflicts resolved status is " + conflictsResolved + " in roots " + myStashedRoots); } @Override diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java index 960621269f9d..1b6dedcd5916 100644 --- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java +++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java @@ -414,10 +414,7 @@ public class GitUnstashDialog extends DialogWrapper { if (conflict.get()) { VirtualFile root = d.getGitRoot(); boolean conflictsResolved = new UnstashConflictResolver(project, root, d.getSelectedStash()).merge(); - if (conflictsResolved) { - LOG.info("loadRoot " + root + " conflicts resolved, dropping stash"); - GitStashUtils.dropStash(project, root); - } + LOG.info("loadRoot " + root + ", conflictsResolved: " + conflictsResolved); } else if (rc != 0) { GitUIUtil.showOperationErrors(project, h.errors(), h.printableCommandLine()); } From a9416cbf44c1718c50c920fbdb0ddf682e8fd820 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 17 Apr 2012 20:05:51 +0400 Subject: [PATCH 36/44] GitUnstashDialog: select the first stash in the list by default. --- plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java index 1b6dedcd5916..a75118b218db 100644 --- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java +++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java @@ -320,6 +320,7 @@ public class GitUnstashDialog extends DialogWrapper { catch (VcsException e) { // ignore error } + myStashList.setSelectedIndex(0); } /** @@ -381,6 +382,11 @@ public class GitUnstashDialog extends DialogWrapper { return "reference.VersionControl.Git.Unstash"; } + @Override + public JComponent getPreferredFocusedComponent() { + return myStashList; + } + /** * Show unstash dialog and process its result * From e74063af3ca805b98d6a854847ff6b0571a7a95e Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Tue, 17 Apr 2012 21:04:40 +0400 Subject: [PATCH 37/44] JDBC console: tab placement switch & IDEA-70265 --- .../com/intellij/openapi/fileEditor/impl/EditorWindow.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java index d71329695812..dcb42a23a658 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java @@ -430,12 +430,17 @@ public class EditorWindow { else if (myTabbedPane != null) { final boolean focusEditor = ToolWindowManager.getInstance(getManager().getProject()).isEditorComponentActive(); final VirtualFile currentFile = getSelectedFile(); + if (currentFile != null) { + // do not close associated language console on tab placement change + currentFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, Boolean.TRUE); + } final VirtualFile[] files = getFiles(); for (VirtualFile file : files) { closeFile(file, false); } disposeTabs(); if (currentFile != null) { + currentFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, null); getManager().openFileImpl2(this, currentFile, focusEditor && myOwner.getCurrentWindow() == this); } else { From d1c25a19d7e3fc2e57d1191c58c2cc2a34827fe8 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Tue, 17 Apr 2012 22:04:32 +0400 Subject: [PATCH 38/44] TableLayout --- .../layout/CaptionStaticDecorator.java | 9 +- .../layout/TableLayoutDecorator.java | 42 +-- .../layout/TableLayoutOperation.java | 240 ++++++++++++++---- .../designer/model/table/GridInfo.java | 31 +++ .../designer/model/table/GridInsertType.java | 29 +++ .../model/table/RadCaptionTableColumn.java | 12 +- .../model/table/RadCaptionTableRow.java | 9 +- .../designer/model/table/RadTableLayout.java | 15 +- .../model/table/RadTableLayoutComponent.java | 169 ++++++++++-- .../model/table/RadTableRowLayout.java | 4 + .../feedbacks/AlphaFeedback.java | 28 ++ 11 files changed, 481 insertions(+), 107 deletions(-) create mode 100644 plugins/android-designer/src/com/intellij/android/designer/model/table/GridInfo.java create mode 100644 plugins/android-designer/src/com/intellij/android/designer/model/table/GridInsertType.java diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/CaptionStaticDecorator.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/CaptionStaticDecorator.java index 3f5770a90634..029d6c764f48 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/CaptionStaticDecorator.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/CaptionStaticDecorator.java @@ -26,14 +26,21 @@ import java.awt.*; * @author Alexander Lobas */ public class CaptionStaticDecorator extends StaticDecorator { + private final Color myColor; + public CaptionStaticDecorator(RadComponent component) { + this(component, LightColors.GREEN); + } + + public CaptionStaticDecorator(RadComponent component, Color color) { super(component); + myColor = color; } @Override protected void paint(DecorationLayer layer, Graphics2D g, RadComponent component) { Rectangle bounds = component.getBounds(layer); - g.setColor(LightColors.GREEN); + g.setColor(myColor); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); g.setColor(Color.black); g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutDecorator.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutDecorator.java index d880e515f621..72c5dde6a686 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutDecorator.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutDecorator.java @@ -15,14 +15,13 @@ */ package com.intellij.android.designer.designSurface.layout; -import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.android.designer.model.table.GridInfo; import com.intellij.android.designer.model.table.RadTableLayoutComponent; import com.intellij.designer.designSurface.DecorationLayer; import com.intellij.designer.designSurface.StaticDecorator; import com.intellij.designer.model.RadComponent; import java.awt.*; -import java.util.List; /** * @author Alexander Lobas @@ -39,42 +38,17 @@ public class TableLayoutDecorator extends StaticDecorator { g.setStroke(FlowStaticDecorator.STROKE); Rectangle bounds = component.getBounds(layer); - int[] columnWidths = ((RadTableLayoutComponent)component).getColumnWidths(); + GridInfo gridInfo = ((RadTableLayoutComponent)component).getGridInfo(); - if (columnWidths != null && columnWidths.length > 0) { - int x = bounds.x; - - for (int i = 0; i < columnWidths.length; i++) { - int width = columnWidths[i]; - - if (width > 0) { - x += width; - - if (i != columnWidths.length - 1 || x < bounds.getMinX()) { - g.drawLine(x, bounds.y, x, bounds.y + bounds.height); - } - } - else { - g.drawLine(x + 2, bounds.y, x + 2, bounds.y + bounds.height); - } - } - - bounds.width = Math.max(bounds.width, x - bounds.x); + for (int x : gridInfo.vLines) { + g.drawLine(bounds.x + x, bounds.y, bounds.x + x, bounds.y + gridInfo.height); } - - List children = component.getChildren(); - RadComponent last = children.isEmpty() ? null : children.get(children.size() - 1); - - for (RadComponent child : children) { - Rectangle childBounds = child.getBounds(layer); - int y = childBounds.y + childBounds.height + ((RadViewComponent)child).getMargins().height; - - if (child != last || y < bounds.getMaxY()) { - g.drawLine(bounds.x, y, bounds.x + bounds.width, y); - } + for (int y : gridInfo.hLines) { + g.drawLine(bounds.x, bounds.y + y, bounds.x + gridInfo.width, bounds.y + y); } g.setStroke(stroke); - g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); + g.drawRect(bounds.x, bounds.y, gridInfo.width, gridInfo.height); + g.drawRect(bounds.x + 1, bounds.y + 1, gridInfo.width - 2, gridInfo.height - 2); } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutOperation.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutOperation.java index f0d700b7c228..da701526e26b 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutOperation.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutOperation.java @@ -16,39 +16,57 @@ package com.intellij.android.designer.designSurface.layout; import com.intellij.android.designer.designSurface.AbstractEditOperation; -import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.android.designer.model.table.GridInfo; +import com.intellij.android.designer.model.table.GridInsertType; import com.intellij.android.designer.model.table.RadTableLayoutComponent; import com.intellij.designer.designSurface.FeedbackLayer; import com.intellij.designer.designSurface.OperationContext; +import com.intellij.designer.designSurface.feedbacks.AlphaFeedback; +import com.intellij.designer.designSurface.feedbacks.LineInsertFeedback; import com.intellij.designer.model.RadComponent; import javax.swing.*; import java.awt.*; -import java.util.List; /** * @author Alexander Lobas */ public class TableLayoutOperation extends AbstractEditOperation { private GridFeedback myFeedback; + private LineInsertFeedback myHInsertFeedback; + private LineInsertFeedback myVInsertFeedback; + private int myColumn; + private int myRow; + private GridInsertType myInsertType; + private boolean myExist; public TableLayoutOperation(RadComponent container, OperationContext context) { super(container, context); } - private void createFeedback() { - if (myFeedback == null) { - FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); - myFeedback = new GridFeedback(); - myFeedback.setBounds(myContainer.getBounds(layer)); - layer.add(myFeedback); - layer.repaint(); - } + private GridInfo getGridInfo() { + return ((RadTableLayoutComponent)myContainer).getVirtualGridInfo(); } @Override public void showFeedback() { - createFeedback(); + if (myFeedback == null) { + FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); + + myFeedback = new GridFeedback(); + myFeedback.setBounds(myContainer.getBounds(layer)); + + myHInsertFeedback = new LineInsertFeedback(Color.green, true); + myVInsertFeedback = new LineInsertFeedback(Color.green, false); + + layer.add(myFeedback); + layer.add(myHInsertFeedback); + layer.add(myVInsertFeedback); + layer.repaint(); + } + + calculateGridInfo(); + myFeedback.repaint(); } @Override @@ -56,64 +74,192 @@ public class TableLayoutOperation extends AbstractEditOperation { if (myFeedback != null) { FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); layer.remove(myFeedback); + layer.add(myHInsertFeedback); + layer.add(myVInsertFeedback); layer.repaint(); myFeedback = null; + myHInsertFeedback = null; + myVInsertFeedback = null; } } + private void calculateGridInfo() { + GridInfo gridInfo = getGridInfo(); + Point location = SwingUtilities.convertPoint(myContext.getArea().getFeedbackLayer(), myContext.getLocation(), myFeedback); + + myColumn = getLineIndex(gridInfo.vLines, location.x); + myRow = getLineIndex(gridInfo.hLines, location.y); + + RadComponent[][] components = gridInfo.components; + if (components == null) { + myInsertType = GridInsertType.in_cell; + myExist = false; + } + else { + myInsertType = null; + + Rectangle bounds = myContainer.getBounds(myContext.getArea().getFeedbackLayer()); + Rectangle cellRect = getInsertRect(myExist); + Rectangle inCellRect = getInsertInRect(cellRect); + + if (inCellRect.contains(location)) { + myInsertType = GridInsertType.in_cell; + + myHInsertFeedback.setVisible(false); + myVInsertFeedback.setVisible(false); + } + else if (location.x < inCellRect.x) { + myInsertType = GridInsertType.before_v_cell; + + myHInsertFeedback.setVisible(false); + + myVInsertFeedback.setLocation(bounds.x + cellRect.x, bounds.y + cellRect.y); + myVInsertFeedback.setSize(0, cellRect.height); + myVInsertFeedback.setVisible(true); + } + else if (location.x > inCellRect.x) { + myInsertType = GridInsertType.after_v_cell; + + myHInsertFeedback.setVisible(false); + + myVInsertFeedback.setLocation(bounds.x + cellRect.x + cellRect.width, bounds.y + cellRect.y); + myVInsertFeedback.setSize(0, cellRect.height); + myVInsertFeedback.setVisible(true); + } + else if (location.y < inCellRect.y) { + myInsertType = GridInsertType.before_h_cell; + + myHInsertFeedback.setVisible(true); + myHInsertFeedback.setLocation(bounds.x + cellRect.x, bounds.y + cellRect.y); + myHInsertFeedback.setSize(cellRect.width, 0); + + myVInsertFeedback.setVisible(false); + } + else if (location.y > inCellRect.y) { + myInsertType = GridInsertType.after_h_cell; + + myHInsertFeedback.setVisible(true); + myHInsertFeedback.setLocation(bounds.x + cellRect.x, bounds.y + cellRect.y + cellRect.height); + myHInsertFeedback.setSize(cellRect.width, 0); + + myVInsertFeedback.setVisible(false); + } + + if (myInsertType == GridInsertType.in_cell) { + if (myRow < components.length && myColumn < components[0].length) { + myExist = components[myRow][myColumn] != null; + } + else { + myExist = false; + } + } + } + } + + private static int getLineIndex(int[] line, int location) { + for (int i = 0; i < line.length - 1; i++) { + if (line[i] <= location && location <= line[i + 1]) { + return i; + } + } + return Math.max(0, line.length - 1); + } + + private Rectangle getInsertRect(boolean includeSpan) { + GridInfo gridInfo = getGridInfo(); + int startColumn = myColumn; + int endColumn = myColumn + 1; + + if (includeSpan) { + RadComponent[] columnComponents = gridInfo.components[myRow]; + RadComponent existComponent = columnComponents[startColumn]; + + while (startColumn > 0) { + if (columnComponents[startColumn - 1] == existComponent) { + startColumn--; + } + else { + break; + } + } + + while (endColumn < columnComponents.length) { + if (columnComponents[endColumn] == existComponent) { + endColumn++; + } + else { + break; + } + } + } + + int x1 = startColumn < gridInfo.vLines.length ? gridInfo.vLines[startColumn] : 0; + int x2 = endColumn < gridInfo.vLines.length ? gridInfo.vLines[endColumn] : gridInfo.width; + + int y1 = myRow < gridInfo.hLines.length ? gridInfo.hLines[myRow] : 0; + int y2 = myRow + 1 < gridInfo.hLines.length ? gridInfo.hLines[myRow + 1] : gridInfo.height; + + return new Rectangle(x1, y1, x2 - x1, y2 - y1); + } + + private static Rectangle getInsertInRect(Rectangle cellRect) { + int borderWidth = getInsertBorderLength(cellRect.width); + int borderHeight = getInsertBorderLength(cellRect.height); + return new Rectangle(cellRect.x + borderWidth, cellRect.y + borderHeight, cellRect.width - 2 * borderWidth, + cellRect.height - 2 * borderHeight); + } + + private static int getInsertBorderLength(int length) { + int border = 5; + if (length < 3 * border) { + border = length / 3; + } + return border; + } + + @Override + public boolean canExecute() { + return !myExist; + } + + @Override + public void execute() throws Exception { + super.execute(); // TODO: Auto-generated method stub + } + ////////////////////////////////////////////////////////////////////////////////////////// // // Feedback // ////////////////////////////////////////////////////////////////////////////////////////// - public static final Color COLOR = new Color(80, 110, 160); - private class GridFeedback extends JComponent { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); - g.setColor(COLOR); + g.setColor(BorderStaticDecorator.COLOR); - Rectangle bounds = getBounds(); - bounds.x = bounds.y = 0; + GridInfo gridInfo = getGridInfo(); - int[] columnWidths = ((RadTableLayoutComponent)myContainer).getColumnWidths(); - - if (columnWidths != null && columnWidths.length > 0) { - int x = bounds.x; - - for (int i = 0; i < columnWidths.length; i++) { - int width = columnWidths[i]; - - if (width > 0) { - x += width; - - if (i != columnWidths.length - 1 || x < bounds.getMinX()) { - g.drawLine(x, bounds.y, x, bounds.y + bounds.height); - } - } - else { - g.drawLine(x + 2, bounds.y, x + 2, bounds.y + bounds.height); - } - } - - bounds.width = Math.max(bounds.width, x - bounds.x); + for (int x : gridInfo.vLines) { + g.drawLine(x, 0, x, gridInfo.height); } + for (int y : gridInfo.hLines) { + g.drawLine(0, y, gridInfo.width, y); + } + g.drawRect(0, 0, gridInfo.width - 1, gridInfo.height - 1); + g.drawRect(1, 1, gridInfo.width - 3, gridInfo.height - 3); - List children = myContainer.getChildren(); - RadComponent last = children.isEmpty() ? null : children.get(children.size() - 1); + if (myInsertType == GridInsertType.in_cell) { + Rectangle cellRect = getInsertRect(myExist); - for (RadComponent child : children) { - Rectangle childBounds = child.getBounds(this); - int y = childBounds.y + childBounds.height + ((RadViewComponent)child).getMargins().height; - - if (child != last || y < bounds.getMaxY()) { - g.drawLine(bounds.x, y, bounds.x + bounds.width, y); + if (myExist) { + AlphaFeedback.fillRect2(g, cellRect.x, cellRect.y, cellRect.width, cellRect.height, Color.pink); + } + else { + AlphaFeedback.fillRect1(g, cellRect.x, cellRect.y, cellRect.width, cellRect.height, Color.green); } } - - g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); } } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/GridInfo.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/GridInfo.java new file mode 100644 index 000000000000..35158ac63641 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/GridInfo.java @@ -0,0 +1,31 @@ +/* + * 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. + * 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.android.designer.model.table; + +import com.intellij.designer.model.RadComponent; +import com.intellij.util.ArrayUtil; + +/** + * @author Alexander Lobas + */ +public class GridInfo { + public int width; + public int height; + public int[] hLines = ArrayUtil.EMPTY_INT_ARRAY; + public int[] vLines = ArrayUtil.EMPTY_INT_ARRAY; + public boolean[] emptyColumns = ArrayUtil.EMPTY_BOOLEAN_ARRAY; + public RadComponent[][] components; +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/GridInsertType.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/GridInsertType.java new file mode 100644 index 000000000000..a210473dc78d --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/GridInsertType.java @@ -0,0 +1,29 @@ +/* + * 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. + * 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.android.designer.model.table; + +/** + * @author Alexander Lobas + */ +public enum GridInsertType { + in_cell, + before_h_cell, + after_h_cell, + before_v_cell, + after_v_cell, + before_row, + after_row +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableColumn.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableColumn.java index 502cfb27c903..914e13e16c27 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableColumn.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableColumn.java @@ -30,12 +30,20 @@ public class RadCaptionTableColumn extends RadVisualComponent { private final RadTableLayoutComponent myContainer; private final int myColumnOffset; private final int myColumnWidth; - private final StaticDecorator myDecorator = new CaptionStaticDecorator(this); + private final StaticDecorator myDecorator; - public RadCaptionTableColumn(RadTableLayoutComponent container, int columnOffset, int columnWidth) { + public RadCaptionTableColumn(RadTableLayoutComponent container, int columnOffset, int columnWidth, boolean empty) { myContainer = container; myColumnOffset = columnOffset; myColumnWidth = columnWidth; + + if (empty) { + myDecorator = new CaptionStaticDecorator(this, Color.PINK); + } + else { + myDecorator = new CaptionStaticDecorator(this); + } + setNativeComponent(container.getNativeComponent()); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableRow.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableRow.java index d0d9f199eadd..d4b7c8012953 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableRow.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableRow.java @@ -29,10 +29,17 @@ import java.util.List; */ public class RadCaptionTableRow extends RadVisualComponent { private final RadViewComponent myComponent; - private final StaticDecorator myDecorator = new CaptionStaticDecorator(this); + private final StaticDecorator myDecorator; public RadCaptionTableRow(RadViewComponent component) { myComponent = component; + + if (RadTableRowLayout.is(component)) { + myDecorator = new CaptionStaticDecorator(this); + } else { + myDecorator = new CaptionStaticDecorator(this, Color.PINK); + } + setNativeComponent(component.getNativeComponent()); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayout.java index 50343c814537..a2901c650352 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayout.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayout.java @@ -97,7 +97,7 @@ public class RadTableLayout extends RadViewLayoutWithData implements ILayoutDeco @Override public ComponentDecorator getChildSelectionDecorator(RadComponent component, List selection) { - if (component.getLayout() instanceof RadTableRowLayout) { + if (RadTableRowLayout.is(component)) { return super.getChildSelectionDecorator(component, selection); } @@ -165,10 +165,15 @@ public class RadTableLayout extends RadViewLayoutWithData implements ILayoutDeco List components = new ArrayList(); if (horizontal) { - int columnOffset = 0; - for (int columnWidth : container.getColumnWidths()) { - components.add(new RadCaptionTableColumn(container, columnOffset, Math.max(columnWidth, 2))); - columnOffset += columnWidth; + GridInfo gridInfo = container.getGridInfo(); + int[] lines = gridInfo.vLines; + boolean[] emptyColumns = gridInfo.emptyColumns; + + for (int i = 0; i < lines.length - 1; i++) { + components.add(new RadCaptionTableColumn(container, + lines[i], + lines[i + 1] - lines[i], + emptyColumns[i])); } } else { diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayoutComponent.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayoutComponent.java index e478251c11cc..d2c691975f95 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayoutComponent.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayoutComponent.java @@ -16,40 +16,175 @@ package com.intellij.android.designer.model.table; import com.android.ide.common.rendering.api.ViewInfo; +import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.model.RadViewContainer; +import com.intellij.designer.model.RadComponent; import com.intellij.util.ArrayUtil; -import org.jetbrains.annotations.Nullable; +import java.awt.*; import java.lang.reflect.Field; +import java.util.List; /** * @author Alexander Lobas */ public class RadTableLayoutComponent extends RadViewContainer { - private int[] myColumnWidths; + private GridInfo myGridInfo; + private GridInfo myVirtualGridInfo; @Override public void setViewInfo(ViewInfo viewInfo) { super.setViewInfo(viewInfo); - myColumnWidths = null; + myGridInfo = null; + myVirtualGridInfo = null; } - @Nullable - public int[] getColumnWidths() { - if (myColumnWidths == null) { - try { - Object viewObject = myViewInfo.getViewObject(); - Class viewClass = viewObject.getClass(); - Field maxWidths = viewClass.getDeclaredField("mMaxWidths"); - maxWidths.setAccessible(true); - myColumnWidths = (int[])maxWidths.get(viewObject); + private int[] getColumnWidths() { + try { + Object viewObject = myViewInfo.getViewObject(); + Class viewClass = viewObject.getClass(); + Field maxWidths = viewClass.getDeclaredField("mMaxWidths"); + maxWidths.setAccessible(true); + int[] columnWidths = (int[])maxWidths.get(viewObject); + return columnWidths == null ? ArrayUtil.EMPTY_INT_ARRAY : columnWidths; + } + catch (Throwable e) { + return ArrayUtil.EMPTY_INT_ARRAY; + } + } + + public GridInfo getGridInfo() { + if (myGridInfo == null) { + myGridInfo = new GridInfo(); + + int[] columnWidths = getColumnWidths(); + if (columnWidths.length > 0) { + myGridInfo.emptyColumns = new boolean[columnWidths.length]; + myGridInfo.vLines = new int[columnWidths.length + 1]; + + for (int i = 0; i < columnWidths.length; i++) { + int width = Math.max(columnWidths[i], 0); + myGridInfo.emptyColumns[i] = width == 0; + + if (width == 0) { + width = 2; + if (i + 1 < columnWidths.length) { + columnWidths[i + 1] -= width; + } + } + + myGridInfo.width += width; + myGridInfo.vLines[i + 1] = myGridInfo.width; + } } - catch (Throwable e) { - } - if (myColumnWidths == null) { - myColumnWidths = ArrayUtil.EMPTY_INT_ARRAY; + + List rows = getChildren(); + if (!rows.isEmpty()) { + Rectangle bounds = getBounds(); + if (columnWidths.length == 0) { + myGridInfo.width = bounds.width; + } + + myGridInfo.hLines = new int[rows.size() + 1]; + int index = 1; + for (RadComponent row : rows) { + Rectangle rowBounds = row.getBounds(); + myGridInfo.hLines[index++] = myGridInfo.height = rowBounds.y - bounds.y + rowBounds.height; + } } } - return myColumnWidths; + return myGridInfo; + } + + public GridInfo getVirtualGridInfo() { + if (myVirtualGridInfo == null) { + myVirtualGridInfo = new GridInfo(); + GridInfo gridInfo = getGridInfo(); + Rectangle bounds = getBounds(); + + myVirtualGridInfo.width = bounds.width; + myVirtualGridInfo.height = bounds.height; + + myVirtualGridInfo.vLines = addLineInfo(gridInfo.vLines, bounds.width - (gridInfo.vLines.length == 0 ? 0 : gridInfo.width)); + myVirtualGridInfo.hLines = addLineInfo(gridInfo.hLines, bounds.height - gridInfo.height); + + List rows = getChildren(); + if (!rows.isEmpty()) { + int columnSize = Math.max(1, gridInfo.vLines.length - 1); + RadComponent[][] components = new RadComponent[rows.size()][columnSize]; + myVirtualGridInfo.components = components; + + for (int i = 0; i < components.length; i++) { + RadComponent row = rows.get(i); + + if (RadTableRowLayout.is(row)) { + int index = 0; + for (RadComponent column : row.getChildren()) { + int cellIndex = getCellIndex(column); + if (cellIndex > index) { + index = cellIndex; + } + + int cellSpan = getCellSnap(column); + for (int j = 0; j < cellSpan; j++) { + components[i][index++] = column; + } + } + } + else { + components[i][0] = row; + } + } + } + } + return myVirtualGridInfo; + } + + private static int getCellIndex(RadComponent component) { + try { + String column = ((RadViewComponent)component).getTag().getAttributeValue("android:layout_column"); + return Integer.parseInt(column); + } + catch (Throwable e) { + return -1; + } + } + + private static int getCellSnap(RadComponent component) { + try { + String span = ((RadViewComponent)component).getTag().getAttributeValue("android:layout_span"); + return Integer.parseInt(span); + } + catch (Throwable e) { + return 1; + } + } + + private static final int NEW_CELL_SIZE = 32; + + private static int[] addLineInfo(int[] oldLines, int delta) { + if (delta > 0) { + int newLength = oldLines.length + delta / NEW_CELL_SIZE; + + if (newLength > oldLines.length) { + int[] newLines = new int[newLength]; + int startIndex = oldLines.length; + + if (oldLines.length > 0) { + System.arraycopy(oldLines, 0, newLines, 0, oldLines.length); + } + else { + startIndex = 1; + } + + for (int i = startIndex; i < newLength; i++) { + newLines[i] = newLines[i - 1] + NEW_CELL_SIZE; + } + + return newLines; + } + return oldLines; + } + return oldLines; } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableRowLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableRowLayout.java index e234106de44d..0c585c90103a 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableRowLayout.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableRowLayout.java @@ -36,6 +36,10 @@ public class RadTableRowLayout extends RadLinearLayout { return LAYOUT_PARAMS; } + public static boolean is(RadComponent component) { + return component.getLayout() instanceof RadTableRowLayout; + } + private boolean isTableParent() { return myContainer.getParent() instanceof RadTableLayoutComponent; } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/feedbacks/AlphaFeedback.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/feedbacks/AlphaFeedback.java index 55736b88bd78..42726440be34 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/feedbacks/AlphaFeedback.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/feedbacks/AlphaFeedback.java @@ -57,4 +57,32 @@ public class AlphaFeedback extends JComponent { protected void paintOther2(Graphics2D g2d) { g2d.drawRect(0, 0, getWidth() - 1, getHeight() - 1); } + + ////////////////////////////////////////////////////////////////////////////////////////// + // + // Utils + // + ////////////////////////////////////////////////////////////////////////////////////////// + + public static void fillRect1(Graphics g, int x, int y, int width, int height, Color color) { + fillRect(g, x, y, width, height, color, myComposite1); + } + + public static void fillRect2(Graphics g, int x, int y, int width, int height, Color color) { + fillRect(g, x, y, width, height, color, myComposite2); + } + + public static void fillRect(Graphics g, int x, int y, int width, int height, Color color, Composite composite) { + Graphics2D g2d = (Graphics2D)g; + Composite oldComposite = g2d.getComposite(); + Color oldColor = g.getColor(); + + g2d.setColor(color); + g2d.setComposite(composite); + + g2d.fillRect(x, y, width, height); + + g2d.setComposite(oldComposite); + g2d.setColor(oldColor); + } } \ No newline at end of file From 638f12118f26588c3bfd9d0675a6cdf85bf21234 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Tue, 17 Apr 2012 20:14:18 +0200 Subject: [PATCH 39/44] command line version of out-of-process make --- .../proto/cmdline_remote_proto.proto | 135 + jps/jps-builders/proto/gen_proto.bat | 3 +- jps/jps-builders/proto/gen_proto.sh | 3 +- .../jetbrains/jps/api/CmdlineProtoUtil.java | 121 + .../jetbrains/jps/api/CmdlineRemoteProto.java | 7534 +++++++++++++++++ .../org/jetbrains/jps/cmdline/BuildMain.java | 144 + .../jetbrains/jps/cmdline/BuildSession.java | 406 + 7 files changed, 8344 insertions(+), 2 deletions(-) create mode 100644 jps/jps-builders/proto/cmdline_remote_proto.proto create mode 100644 jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java create mode 100644 jps/jps-builders/src/org/jetbrains/jps/api/CmdlineRemoteProto.java create mode 100644 jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildMain.java create mode 100644 jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildSession.java diff --git a/jps/jps-builders/proto/cmdline_remote_proto.proto b/jps/jps-builders/proto/cmdline_remote_proto.proto new file mode 100644 index 000000000000..4452e21752e3 --- /dev/null +++ b/jps/jps-builders/proto/cmdline_remote_proto.proto @@ -0,0 +1,135 @@ +package org.jetbrains.jpsservice; + +option java_package = "org.jetbrains.jps.api"; +option optimize_for = LITE_RUNTIME; + +message Message { + + message UUID { + required sint64 most_sig_bits = 1; + required sint64 least_sig_bits = 2; + } + + message KeyValuePair { + required string key = 1; + required string value = 2; + } + + enum Type { + CONTROLLER_MESSAGE = 1; + BUILDER_MESSAGE = 2; + FAILURE = 3; + } + + message Failure { + optional int32 error_code = 1; + optional string description = 2; + optional string stacktrace = 3; + } + + message ControllerMessage { + enum Type { + BUILD_PARAMETERS = 1; + CANCEL_BUILD_COMMAND = 2; + } + + message GlobalSettings { + + message GlobalLibrary { + required string name = 1; + optional string homePath = 2; + optional string type_name = 3; + optional string additional_data_xml = 4; + repeated string path = 5; + optional string version = 6; + } + + repeated KeyValuePair path_variable = 1; + repeated GlobalLibrary global_library = 2; + optional string global_encoding = 3; + optional string ignored_files_patterns = 4; + } + + message ParametersMessage { + enum Type { + REBUILD = 1; + MAKE = 2; + CLEAN = 3; + FORCED_COMPILATION = 4; + } + + required Type build_type = 1; + optional GlobalSettings global_settings = 2; + optional string project_id = 3; + repeated string module_name = 4; + repeated string file_path = 5; + repeated string artifact_name = 6; + repeated KeyValuePair builder_parameter = 7; + } + + required Type type = 1; + optional ParametersMessage params_message = 2; + } + + message BuilderMessage { + enum Type { + PARAM_REQUEST = 1; + BUILD_EVENT = 2; + COMPILE_MESSAGE = 3; + } + + message BuildEvent { + enum Type { + BUILD_COMPLETED = 1; + FILES_GENERATED = 2; + } + + enum Status { + CANCELED = 1; + ERRORS = 2; + SUCCESS = 3; + UP_TO_DATE = 4; + } + + message GeneratedFile { + required string output_root = 1; + required string relative_path = 2; + } + + required Type event_type = 1; + optional string description = 2; + optional Status completion_status = 3; + repeated GeneratedFile generated_files = 4; + } + + message CompileMessage { + enum Kind { + ERROR = 1; + WARNING = 2; + INFO = 3; + PROGRESS = 4; + } + required Kind kind = 1; + optional string text = 2; + optional string source_file_path = 3; + optional uint64 problem_begin_offset = 4; + optional uint64 problem_end_offset = 5; + optional uint64 problem_location_offset = 6; + optional uint64 line = 7; + optional uint64 column = 8; + optional float done = 9; + } + + required Type type = 1; + optional BuildEvent build_event = 2; + optional CompileMessage compile_message = 3; + } + + required UUID session_id = 1; + required Type type = 2; + optional ControllerMessage controller_message = 3; + optional BuilderMessage builder_message = 4; + optional Failure failure = 5; +} + + diff --git a/jps/jps-builders/proto/gen_proto.bat b/jps/jps-builders/proto/gen_proto.bat index 0ff63df43eff..51876bbc7cc1 100644 --- a/jps/jps-builders/proto/gen_proto.bat +++ b/jps/jps-builders/proto/gen_proto.bat @@ -1,2 +1,3 @@ call protoc -I=. --java_out=../src javac_remote_proto.proto -call protoc -I=. --java_out=../src jps_remote_proto.proto \ No newline at end of file +call protoc -I=. --java_out=../src jps_remote_proto.proto +call protoc -I=. --java_out=../src cmdline_remote_proto.proto \ No newline at end of file diff --git a/jps/jps-builders/proto/gen_proto.sh b/jps/jps-builders/proto/gen_proto.sh index 0a2ba92d332e..0d06406b882a 100755 --- a/jps/jps-builders/proto/gen_proto.sh +++ b/jps/jps-builders/proto/gen_proto.sh @@ -1,2 +1,3 @@ protoc -I=. --java_out=../src javac_remote_proto.proto -protoc -I=. --java_out=../src jps_remote_proto.proto \ No newline at end of file +protoc -I=. --java_out=../src jps_remote_proto.proto +protoc -I=. --java_out=../src cmdline_remote_proto.proto \ No newline at end of file diff --git a/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java b/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java new file mode 100644 index 000000000000..55b23a31597f --- /dev/null +++ b/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineProtoUtil.java @@ -0,0 +1,121 @@ +package org.jetbrains.jps.api; + +import com.intellij.openapi.util.Pair; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jps.incremental.messages.BuildMessage; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.Collection; +import java.util.UUID; + +/** + * @author Eugene Zhuravlev + * Date: 4/17/12 + */ +public class CmdlineProtoUtil { + public static CmdlineRemoteProto.Message.Failure createFailure(String description, Throwable cause) { + final CmdlineRemoteProto.Message.Failure.Builder builder = CmdlineRemoteProto.Message.Failure.newBuilder(); + builder.setDescription(description); + if (cause != null) { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + cause.printStackTrace(new PrintStream(baos)); + builder.setStacktrace(new String(baos.toByteArray())); + } + return builder.build(); + } + + public static CmdlineRemoteProto.Message.BuilderMessage createCompileProgressMessageResponse(String text, float done) { + return createCompileMessageResponse(BuildMessage.Kind.PROGRESS, text, null, -1L, -1L, -1L, -1, -1, done); + } + + public static CmdlineRemoteProto.Message.BuilderMessage createCompileMessageResponse(final BuildMessage.Kind kind, + String text, + String path, + long beginOffset, long endOffset, long offset, long line, + long column, float done) { + + final CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Builder builder = CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.newBuilder(); + switch (kind) { + case ERROR: + builder.setKind(CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR); + break; + case WARNING: + builder.setKind(CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.WARNING); + break; + case INFO: + builder.setKind(CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.INFO); + break; + default: + builder.setKind(CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.PROGRESS); + } + if (text != null) { + builder.setText(text); + } + if (path != null) { + builder.setSourceFilePath(path); + } + if (beginOffset >= 0L) { + builder.setProblemBeginOffset(beginOffset); + } + if (endOffset >= 0L) { + builder.setProblemEndOffset(endOffset); + } + if (offset >= 0L) { + builder.setProblemLocationOffset(offset); + } + if (line > 0L) { + builder.setLine(line); + } + if (column > 0L) { + builder.setColumn(column); + } + if (done >= 0.0f) { + builder.setDone(done); + } + return CmdlineRemoteProto.Message.BuilderMessage.newBuilder().setType(CmdlineRemoteProto.Message.BuilderMessage.Type.COMPILE_MESSAGE).setCompileMessage(builder.build()).build(); + } + + public static CmdlineRemoteProto.Message.BuilderMessage createBuildCompletedEvent(@Nullable String description, final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status status) { + return createBuildEvent(CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type.BUILD_COMPLETED, description, status, null); + } + + public static CmdlineRemoteProto.Message.BuilderMessage createFileGeneratedEvent(final Collection> paths) { + return createBuildEvent(CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type.FILES_GENERATED, null, null, paths); + } + + public static CmdlineRemoteProto.Message.BuilderMessage createBuildEvent(final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type type, @Nullable String description, final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status status, Collection> generatedPaths) { + final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Builder builder = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.newBuilder().setEventType(type); + if (description != null) { + builder.setDescription(description); + } + if (status != null) { + builder.setCompletionStatus(status); + } + if (generatedPaths != null) { + for (Pair pair : generatedPaths) { + final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.Builder fileBuilder = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.newBuilder(); + final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile generatedFile = fileBuilder.setOutputRoot(pair.first).setRelativePath(pair.second).build(); + builder.addGeneratedFiles(generatedFile); + } + } + return CmdlineRemoteProto.Message.BuilderMessage.newBuilder().setType(CmdlineRemoteProto.Message.BuilderMessage.Type.BUILD_EVENT).setBuildEvent(builder.build()).build(); + } + + public static CmdlineRemoteProto.Message.BuilderMessage createParamRequest() { + return CmdlineRemoteProto.Message.BuilderMessage.newBuilder().setType(CmdlineRemoteProto.Message.BuilderMessage.Type.PARAM_REQUEST).build(); + } + + public static CmdlineRemoteProto.Message toMessage(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage builderMessage) { + return CmdlineRemoteProto.Message.newBuilder().setSessionId(toProtoUUID(sessionId)).setType(CmdlineRemoteProto.Message.Type.BUILDER_MESSAGE).setBuilderMessage(builderMessage).build(); + } + + public static CmdlineRemoteProto.Message toMessage(UUID sessionId, CmdlineRemoteProto.Message.Failure failure) { + return CmdlineRemoteProto.Message.newBuilder().setSessionId(toProtoUUID(sessionId)).setType(CmdlineRemoteProto.Message.Type.FAILURE).setFailure(failure).build(); + } + + private static CmdlineRemoteProto.Message.UUID toProtoUUID(UUID sessionId) { + final CmdlineRemoteProto.Message.UUID.Builder uuidBuilder = CmdlineRemoteProto.Message.UUID.newBuilder(); + return uuidBuilder.setMostSigBits(sessionId.getMostSignificantBits()).setLeastSigBits(sessionId.getLeastSignificantBits()).build(); + } +} diff --git a/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineRemoteProto.java b/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineRemoteProto.java new file mode 100644 index 000000000000..5cea6d450fbe --- /dev/null +++ b/jps/jps-builders/src/org/jetbrains/jps/api/CmdlineRemoteProto.java @@ -0,0 +1,7534 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: cmdline_remote_proto.proto + +package org.jetbrains.jps.api; + +public final class CmdlineRemoteProto { + private CmdlineRemoteProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + public interface MessageOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required .org.jetbrains.jpsservice.Message.UUID session_id = 1; + boolean hasSessionId(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID getSessionId(); + + // required .org.jetbrains.jpsservice.Message.Type type = 2; + boolean hasType(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type getType(); + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage controller_message = 3; + boolean hasControllerMessage(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage getControllerMessage(); + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage builder_message = 4; + boolean hasBuilderMessage(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage getBuilderMessage(); + + // optional .org.jetbrains.jpsservice.Message.Failure failure = 5; + boolean hasFailure(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure getFailure(); + } + public static final class Message extends + com.google.protobuf.GeneratedMessageLite + implements MessageOrBuilder { + // Use Message.newBuilder() to construct. + private Message(Builder builder) { + super(builder); + } + private Message(boolean noInit) {} + + private static final Message defaultInstance; + public static Message getDefaultInstance() { + return defaultInstance; + } + + public Message getDefaultInstanceForType() { + return defaultInstance; + } + + public enum Type + implements com.google.protobuf.Internal.EnumLite { + CONTROLLER_MESSAGE(0, 1), + BUILDER_MESSAGE(1, 2), + FAILURE(2, 3), + ; + + public static final int CONTROLLER_MESSAGE_VALUE = 1; + public static final int BUILDER_MESSAGE_VALUE = 2; + public static final int FAILURE_VALUE = 3; + + + public final int getNumber() { return value; } + + public static Type valueOf(int value) { + switch (value) { + case 1: return CONTROLLER_MESSAGE; + case 2: return BUILDER_MESSAGE; + case 3: return FAILURE; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Type findValueByNumber(int number) { + return Type.valueOf(number); + } + }; + + private final int value; + + private Type(int index, int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.jetbrains.jpsservice.Message.Type) + } + + public interface UUIDOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required sint64 most_sig_bits = 1; + boolean hasMostSigBits(); + long getMostSigBits(); + + // required sint64 least_sig_bits = 2; + boolean hasLeastSigBits(); + long getLeastSigBits(); + } + public static final class UUID extends + com.google.protobuf.GeneratedMessageLite + implements UUIDOrBuilder { + // Use UUID.newBuilder() to construct. + private UUID(Builder builder) { + super(builder); + } + private UUID(boolean noInit) {} + + private static final UUID defaultInstance; + public static UUID getDefaultInstance() { + return defaultInstance; + } + + public UUID getDefaultInstanceForType() { + return defaultInstance; + } + + private int bitField0_; + // required sint64 most_sig_bits = 1; + public static final int MOST_SIG_BITS_FIELD_NUMBER = 1; + private long mostSigBits_; + public boolean hasMostSigBits() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getMostSigBits() { + return mostSigBits_; + } + + // required sint64 least_sig_bits = 2; + public static final int LEAST_SIG_BITS_FIELD_NUMBER = 2; + private long leastSigBits_; + public boolean hasLeastSigBits() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getLeastSigBits() { + return leastSigBits_; + } + + private void initFields() { + mostSigBits_ = 0L; + leastSigBits_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasMostSigBits()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLeastSigBits()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeSInt64(1, mostSigBits_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeSInt64(2, leastSigBits_); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeSInt64Size(1, mostSigBits_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeSInt64Size(2, leastSigBits_); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUIDOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + mostSigBits_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + leastSigBits_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.mostSigBits_ = mostSigBits_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.leastSigBits_ = leastSigBits_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.getDefaultInstance()) return this; + if (other.hasMostSigBits()) { + setMostSigBits(other.getMostSigBits()); + } + if (other.hasLeastSigBits()) { + setLeastSigBits(other.getLeastSigBits()); + } + return this; + } + + public final boolean isInitialized() { + if (!hasMostSigBits()) { + + return false; + } + if (!hasLeastSigBits()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + mostSigBits_ = input.readSInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + leastSigBits_ = input.readSInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required sint64 most_sig_bits = 1; + private long mostSigBits_ ; + public boolean hasMostSigBits() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getMostSigBits() { + return mostSigBits_; + } + public Builder setMostSigBits(long value) { + bitField0_ |= 0x00000001; + mostSigBits_ = value; + + return this; + } + public Builder clearMostSigBits() { + bitField0_ = (bitField0_ & ~0x00000001); + mostSigBits_ = 0L; + + return this; + } + + // required sint64 least_sig_bits = 2; + private long leastSigBits_ ; + public boolean hasLeastSigBits() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getLeastSigBits() { + return leastSigBits_; + } + public Builder setLeastSigBits(long value) { + bitField0_ |= 0x00000002; + leastSigBits_ = value; + + return this; + } + public Builder clearLeastSigBits() { + bitField0_ = (bitField0_ & ~0x00000002); + leastSigBits_ = 0L; + + return this; + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.UUID) + } + + static { + defaultInstance = new UUID(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.UUID) + } + + public interface KeyValuePairOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required string key = 1; + boolean hasKey(); + String getKey(); + + // required string value = 2; + boolean hasValue(); + String getValue(); + } + public static final class KeyValuePair extends + com.google.protobuf.GeneratedMessageLite + implements KeyValuePairOrBuilder { + // Use KeyValuePair.newBuilder() to construct. + private KeyValuePair(Builder builder) { + super(builder); + } + private KeyValuePair(boolean noInit) {} + + private static final KeyValuePair defaultInstance; + public static KeyValuePair getDefaultInstance() { + return defaultInstance; + } + + public KeyValuePair getDefaultInstanceForType() { + return defaultInstance; + } + + private int bitField0_; + // required string key = 1; + public static final int KEY_FIELD_NUMBER = 1; + private java.lang.Object key_; + public boolean hasKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getKey() { + java.lang.Object ref = key_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + key_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string value = 2; + public static final int VALUE_FIELD_NUMBER = 2; + private java.lang.Object value_; + public boolean hasValue() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getValue() { + java.lang.Object ref = value_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + value_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + key_ = ""; + value_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasKey()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasValue()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getKeyBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getValueBytes()); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getKeyBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getValueBytes()); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePairOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + key_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + value_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.key_ = key_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.value_ = value_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.getDefaultInstance()) return this; + if (other.hasKey()) { + setKey(other.getKey()); + } + if (other.hasValue()) { + setValue(other.getValue()); + } + return this; + } + + public final boolean isInitialized() { + if (!hasKey()) { + + return false; + } + if (!hasValue()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + key_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + value_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string key = 1; + private java.lang.Object key_ = ""; + public boolean hasKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + key_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setKey(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + key_ = value; + + return this; + } + public Builder clearKey() { + bitField0_ = (bitField0_ & ~0x00000001); + key_ = getDefaultInstance().getKey(); + + return this; + } + void setKey(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + key_ = value; + + } + + // required string value = 2; + private java.lang.Object value_ = ""; + public boolean hasValue() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + value_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setValue(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + value_ = value; + + return this; + } + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000002); + value_ = getDefaultInstance().getValue(); + + return this; + } + void setValue(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + value_ = value; + + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.KeyValuePair) + } + + static { + defaultInstance = new KeyValuePair(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.KeyValuePair) + } + + public interface FailureOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // optional int32 error_code = 1; + boolean hasErrorCode(); + int getErrorCode(); + + // optional string description = 2; + boolean hasDescription(); + String getDescription(); + + // optional string stacktrace = 3; + boolean hasStacktrace(); + String getStacktrace(); + } + public static final class Failure extends + com.google.protobuf.GeneratedMessageLite + implements FailureOrBuilder { + // Use Failure.newBuilder() to construct. + private Failure(Builder builder) { + super(builder); + } + private Failure(boolean noInit) {} + + private static final Failure defaultInstance; + public static Failure getDefaultInstance() { + return defaultInstance; + } + + public Failure getDefaultInstanceForType() { + return defaultInstance; + } + + private int bitField0_; + // optional int32 error_code = 1; + public static final int ERROR_CODE_FIELD_NUMBER = 1; + private int errorCode_; + public boolean hasErrorCode() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getErrorCode() { + return errorCode_; + } + + // optional string description = 2; + public static final int DESCRIPTION_FIELD_NUMBER = 2; + private java.lang.Object description_; + public boolean hasDescription() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + description_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string stacktrace = 3; + public static final int STACKTRACE_FIELD_NUMBER = 3; + private java.lang.Object stacktrace_; + public boolean hasStacktrace() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getStacktrace() { + java.lang.Object ref = stacktrace_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + stacktrace_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStacktraceBytes() { + java.lang.Object ref = stacktrace_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + stacktrace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + errorCode_ = 0; + description_ = ""; + stacktrace_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt32(1, errorCode_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getDescriptionBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getStacktraceBytes()); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, errorCode_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getDescriptionBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getStacktraceBytes()); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.FailureOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + errorCode_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + description_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + stacktrace_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.errorCode_ = errorCode_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.description_ = description_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.stacktrace_ = stacktrace_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.getDefaultInstance()) return this; + if (other.hasErrorCode()) { + setErrorCode(other.getErrorCode()); + } + if (other.hasDescription()) { + setDescription(other.getDescription()); + } + if (other.hasStacktrace()) { + setStacktrace(other.getStacktrace()); + } + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + errorCode_ = input.readInt32(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + description_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + stacktrace_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional int32 error_code = 1; + private int errorCode_ ; + public boolean hasErrorCode() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getErrorCode() { + return errorCode_; + } + public Builder setErrorCode(int value) { + bitField0_ |= 0x00000001; + errorCode_ = value; + + return this; + } + public Builder clearErrorCode() { + bitField0_ = (bitField0_ & ~0x00000001); + errorCode_ = 0; + + return this; + } + + // optional string description = 2; + private java.lang.Object description_ = ""; + public boolean hasDescription() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + description_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setDescription(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + description_ = value; + + return this; + } + public Builder clearDescription() { + bitField0_ = (bitField0_ & ~0x00000002); + description_ = getDefaultInstance().getDescription(); + + return this; + } + void setDescription(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + description_ = value; + + } + + // optional string stacktrace = 3; + private java.lang.Object stacktrace_ = ""; + public boolean hasStacktrace() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getStacktrace() { + java.lang.Object ref = stacktrace_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + stacktrace_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStacktrace(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + stacktrace_ = value; + + return this; + } + public Builder clearStacktrace() { + bitField0_ = (bitField0_ & ~0x00000004); + stacktrace_ = getDefaultInstance().getStacktrace(); + + return this; + } + void setStacktrace(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + stacktrace_ = value; + + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.Failure) + } + + static { + defaultInstance = new Failure(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.Failure) + } + + public interface ControllerMessageOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required .org.jetbrains.jpsservice.Message.ControllerMessage.Type type = 1; + boolean hasType(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type getType(); + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage params_message = 2; + boolean hasParamsMessage(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage getParamsMessage(); + } + public static final class ControllerMessage extends + com.google.protobuf.GeneratedMessageLite + implements ControllerMessageOrBuilder { + // Use ControllerMessage.newBuilder() to construct. + private ControllerMessage(Builder builder) { + super(builder); + } + private ControllerMessage(boolean noInit) {} + + private static final ControllerMessage defaultInstance; + public static ControllerMessage getDefaultInstance() { + return defaultInstance; + } + + public ControllerMessage getDefaultInstanceForType() { + return defaultInstance; + } + + public enum Type + implements com.google.protobuf.Internal.EnumLite { + BUILD_PARAMETERS(0, 1), + CANCEL_BUILD_COMMAND(1, 2), + ; + + public static final int BUILD_PARAMETERS_VALUE = 1; + public static final int CANCEL_BUILD_COMMAND_VALUE = 2; + + + public final int getNumber() { return value; } + + public static Type valueOf(int value) { + switch (value) { + case 1: return BUILD_PARAMETERS; + case 2: return CANCEL_BUILD_COMMAND; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Type findValueByNumber(int number) { + return Type.valueOf(number); + } + }; + + private final int value; + + private Type(int index, int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.jetbrains.jpsservice.Message.ControllerMessage.Type) + } + + public interface GlobalSettingsOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // repeated .org.jetbrains.jpsservice.Message.KeyValuePair path_variable = 1; + java.util.List + getPathVariableList(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair getPathVariable(int index); + int getPathVariableCount(); + + // repeated .org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings.GlobalLibrary global_library = 2; + java.util.List + getGlobalLibraryList(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary getGlobalLibrary(int index); + int getGlobalLibraryCount(); + + // optional string global_encoding = 3; + boolean hasGlobalEncoding(); + String getGlobalEncoding(); + + // optional string ignored_files_patterns = 4; + boolean hasIgnoredFilesPatterns(); + String getIgnoredFilesPatterns(); + } + public static final class GlobalSettings extends + com.google.protobuf.GeneratedMessageLite + implements GlobalSettingsOrBuilder { + // Use GlobalSettings.newBuilder() to construct. + private GlobalSettings(Builder builder) { + super(builder); + } + private GlobalSettings(boolean noInit) {} + + private static final GlobalSettings defaultInstance; + public static GlobalSettings getDefaultInstance() { + return defaultInstance; + } + + public GlobalSettings getDefaultInstanceForType() { + return defaultInstance; + } + + public interface GlobalLibraryOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required string name = 1; + boolean hasName(); + String getName(); + + // optional string homePath = 2; + boolean hasHomePath(); + String getHomePath(); + + // optional string type_name = 3; + boolean hasTypeName(); + String getTypeName(); + + // optional string additional_data_xml = 4; + boolean hasAdditionalDataXml(); + String getAdditionalDataXml(); + + // repeated string path = 5; + java.util.List getPathList(); + int getPathCount(); + String getPath(int index); + + // optional string version = 6; + boolean hasVersion(); + String getVersion(); + } + public static final class GlobalLibrary extends + com.google.protobuf.GeneratedMessageLite + implements GlobalLibraryOrBuilder { + // Use GlobalLibrary.newBuilder() to construct. + private GlobalLibrary(Builder builder) { + super(builder); + } + private GlobalLibrary(boolean noInit) {} + + private static final GlobalLibrary defaultInstance; + public static GlobalLibrary getDefaultInstance() { + return defaultInstance; + } + + public GlobalLibrary getDefaultInstanceForType() { + return defaultInstance; + } + + private int bitField0_; + // required string name = 1; + public static final int NAME_FIELD_NUMBER = 1; + private java.lang.Object name_; + public boolean hasName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getName() { + java.lang.Object ref = name_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + name_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string homePath = 2; + public static final int HOMEPATH_FIELD_NUMBER = 2; + private java.lang.Object homePath_; + public boolean hasHomePath() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getHomePath() { + java.lang.Object ref = homePath_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + homePath_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getHomePathBytes() { + java.lang.Object ref = homePath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + homePath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string type_name = 3; + public static final int TYPE_NAME_FIELD_NUMBER = 3; + private java.lang.Object typeName_; + public boolean hasTypeName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTypeName() { + java.lang.Object ref = typeName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + typeName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTypeNameBytes() { + java.lang.Object ref = typeName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + typeName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string additional_data_xml = 4; + public static final int ADDITIONAL_DATA_XML_FIELD_NUMBER = 4; + private java.lang.Object additionalDataXml_; + public boolean hasAdditionalDataXml() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getAdditionalDataXml() { + java.lang.Object ref = additionalDataXml_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + additionalDataXml_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getAdditionalDataXmlBytes() { + java.lang.Object ref = additionalDataXml_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + additionalDataXml_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated string path = 5; + public static final int PATH_FIELD_NUMBER = 5; + private com.google.protobuf.LazyStringList path_; + public java.util.List + getPathList() { + return path_; + } + public int getPathCount() { + return path_.size(); + } + public String getPath(int index) { + return path_.get(index); + } + + // optional string version = 6; + public static final int VERSION_FIELD_NUMBER = 6; + private java.lang.Object version_; + public boolean hasVersion() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getVersion() { + java.lang.Object ref = version_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + version_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getVersionBytes() { + java.lang.Object ref = version_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + version_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + name_ = ""; + homePath_ = ""; + typeName_ = ""; + additionalDataXml_ = ""; + path_ = com.google.protobuf.LazyStringArrayList.EMPTY; + version_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getHomePathBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getTypeNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getAdditionalDataXmlBytes()); + } + for (int i = 0; i < path_.size(); i++) { + output.writeBytes(5, path_.getByteString(i)); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(6, getVersionBytes()); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getHomePathBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTypeNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getAdditionalDataXmlBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < path_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(path_.getByteString(i)); + } + size += dataSize; + size += 1 * getPathList().size(); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(6, getVersionBytes()); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibraryOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + homePath_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + typeName_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + additionalDataXml_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + path_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + version_ = ""; + bitField0_ = (bitField0_ & ~0x00000020); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.name_ = name_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.homePath_ = homePath_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.typeName_ = typeName_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.additionalDataXml_ = additionalDataXml_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + path_ = new com.google.protobuf.UnmodifiableLazyStringList( + path_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.path_ = path_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000010; + } + result.version_ = version_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary.getDefaultInstance()) return this; + if (other.hasName()) { + setName(other.getName()); + } + if (other.hasHomePath()) { + setHomePath(other.getHomePath()); + } + if (other.hasTypeName()) { + setTypeName(other.getTypeName()); + } + if (other.hasAdditionalDataXml()) { + setAdditionalDataXml(other.getAdditionalDataXml()); + } + if (!other.path_.isEmpty()) { + if (path_.isEmpty()) { + path_ = other.path_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensurePathIsMutable(); + path_.addAll(other.path_); + } + + } + if (other.hasVersion()) { + setVersion(other.getVersion()); + } + return this; + } + + public final boolean isInitialized() { + if (!hasName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + name_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + homePath_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + typeName_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + additionalDataXml_ = input.readBytes(); + break; + } + case 42: { + ensurePathIsMutable(); + path_.add(input.readBytes()); + break; + } + case 50: { + bitField0_ |= 0x00000020; + version_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string name = 1; + private java.lang.Object name_ = ""; + public boolean hasName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + name_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + name_ = value; + + return this; + } + public Builder clearName() { + bitField0_ = (bitField0_ & ~0x00000001); + name_ = getDefaultInstance().getName(); + + return this; + } + void setName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + name_ = value; + + } + + // optional string homePath = 2; + private java.lang.Object homePath_ = ""; + public boolean hasHomePath() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getHomePath() { + java.lang.Object ref = homePath_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + homePath_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setHomePath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + homePath_ = value; + + return this; + } + public Builder clearHomePath() { + bitField0_ = (bitField0_ & ~0x00000002); + homePath_ = getDefaultInstance().getHomePath(); + + return this; + } + void setHomePath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + homePath_ = value; + + } + + // optional string type_name = 3; + private java.lang.Object typeName_ = ""; + public boolean hasTypeName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTypeName() { + java.lang.Object ref = typeName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + typeName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTypeName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + typeName_ = value; + + return this; + } + public Builder clearTypeName() { + bitField0_ = (bitField0_ & ~0x00000004); + typeName_ = getDefaultInstance().getTypeName(); + + return this; + } + void setTypeName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + typeName_ = value; + + } + + // optional string additional_data_xml = 4; + private java.lang.Object additionalDataXml_ = ""; + public boolean hasAdditionalDataXml() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getAdditionalDataXml() { + java.lang.Object ref = additionalDataXml_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + additionalDataXml_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setAdditionalDataXml(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + additionalDataXml_ = value; + + return this; + } + public Builder clearAdditionalDataXml() { + bitField0_ = (bitField0_ & ~0x00000008); + additionalDataXml_ = getDefaultInstance().getAdditionalDataXml(); + + return this; + } + void setAdditionalDataXml(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + additionalDataXml_ = value; + + } + + // repeated string path = 5; + private com.google.protobuf.LazyStringList path_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensurePathIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + path_ = new com.google.protobuf.LazyStringArrayList(path_); + bitField0_ |= 0x00000010; + } + } + public java.util.List + getPathList() { + return java.util.Collections.unmodifiableList(path_); + } + public int getPathCount() { + return path_.size(); + } + public String getPath(int index) { + return path_.get(index); + } + public Builder setPath( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePathIsMutable(); + path_.set(index, value); + + return this; + } + public Builder addPath(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePathIsMutable(); + path_.add(value); + + return this; + } + public Builder addAllPath( + java.lang.Iterable values) { + ensurePathIsMutable(); + super.addAll(values, path_); + + return this; + } + public Builder clearPath() { + path_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + + return this; + } + void addPath(com.google.protobuf.ByteString value) { + ensurePathIsMutable(); + path_.add(value); + + } + + // optional string version = 6; + private java.lang.Object version_ = ""; + public boolean hasVersion() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public String getVersion() { + java.lang.Object ref = version_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + version_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setVersion(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + version_ = value; + + return this; + } + public Builder clearVersion() { + bitField0_ = (bitField0_ & ~0x00000020); + version_ = getDefaultInstance().getVersion(); + + return this; + } + void setVersion(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000020; + version_ = value; + + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings.GlobalLibrary) + } + + static { + defaultInstance = new GlobalLibrary(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings.GlobalLibrary) + } + + private int bitField0_; + // repeated .org.jetbrains.jpsservice.Message.KeyValuePair path_variable = 1; + public static final int PATH_VARIABLE_FIELD_NUMBER = 1; + private java.util.List pathVariable_; + public java.util.List getPathVariableList() { + return pathVariable_; + } + public java.util.List + getPathVariableOrBuilderList() { + return pathVariable_; + } + public int getPathVariableCount() { + return pathVariable_.size(); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair getPathVariable(int index) { + return pathVariable_.get(index); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePairOrBuilder getPathVariableOrBuilder( + int index) { + return pathVariable_.get(index); + } + + // repeated .org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings.GlobalLibrary global_library = 2; + public static final int GLOBAL_LIBRARY_FIELD_NUMBER = 2; + private java.util.List globalLibrary_; + public java.util.List getGlobalLibraryList() { + return globalLibrary_; + } + public java.util.List + getGlobalLibraryOrBuilderList() { + return globalLibrary_; + } + public int getGlobalLibraryCount() { + return globalLibrary_.size(); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary getGlobalLibrary(int index) { + return globalLibrary_.get(index); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibraryOrBuilder getGlobalLibraryOrBuilder( + int index) { + return globalLibrary_.get(index); + } + + // optional string global_encoding = 3; + public static final int GLOBAL_ENCODING_FIELD_NUMBER = 3; + private java.lang.Object globalEncoding_; + public boolean hasGlobalEncoding() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getGlobalEncoding() { + java.lang.Object ref = globalEncoding_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + globalEncoding_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getGlobalEncodingBytes() { + java.lang.Object ref = globalEncoding_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + globalEncoding_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string ignored_files_patterns = 4; + public static final int IGNORED_FILES_PATTERNS_FIELD_NUMBER = 4; + private java.lang.Object ignoredFilesPatterns_; + public boolean hasIgnoredFilesPatterns() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIgnoredFilesPatterns() { + java.lang.Object ref = ignoredFilesPatterns_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + ignoredFilesPatterns_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIgnoredFilesPatternsBytes() { + java.lang.Object ref = ignoredFilesPatterns_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + ignoredFilesPatterns_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + pathVariable_ = java.util.Collections.emptyList(); + globalLibrary_ = java.util.Collections.emptyList(); + globalEncoding_ = ""; + ignoredFilesPatterns_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getPathVariableCount(); i++) { + if (!getPathVariable(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getGlobalLibraryCount(); i++) { + if (!getGlobalLibrary(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < pathVariable_.size(); i++) { + output.writeMessage(1, pathVariable_.get(i)); + } + for (int i = 0; i < globalLibrary_.size(); i++) { + output.writeMessage(2, globalLibrary_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(3, getGlobalEncodingBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(4, getIgnoredFilesPatternsBytes()); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < pathVariable_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, pathVariable_.get(i)); + } + for (int i = 0; i < globalLibrary_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, globalLibrary_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getGlobalEncodingBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getIgnoredFilesPatternsBytes()); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettingsOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + pathVariable_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + globalLibrary_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + globalEncoding_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + ignoredFilesPatterns_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + pathVariable_ = java.util.Collections.unmodifiableList(pathVariable_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.pathVariable_ = pathVariable_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + globalLibrary_ = java.util.Collections.unmodifiableList(globalLibrary_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.globalLibrary_ = globalLibrary_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000001; + } + result.globalEncoding_ = globalEncoding_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000002; + } + result.ignoredFilesPatterns_ = ignoredFilesPatterns_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.getDefaultInstance()) return this; + if (!other.pathVariable_.isEmpty()) { + if (pathVariable_.isEmpty()) { + pathVariable_ = other.pathVariable_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePathVariableIsMutable(); + pathVariable_.addAll(other.pathVariable_); + } + + } + if (!other.globalLibrary_.isEmpty()) { + if (globalLibrary_.isEmpty()) { + globalLibrary_ = other.globalLibrary_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureGlobalLibraryIsMutable(); + globalLibrary_.addAll(other.globalLibrary_); + } + + } + if (other.hasGlobalEncoding()) { + setGlobalEncoding(other.getGlobalEncoding()); + } + if (other.hasIgnoredFilesPatterns()) { + setIgnoredFilesPatterns(other.getIgnoredFilesPatterns()); + } + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getPathVariableCount(); i++) { + if (!getPathVariable(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getGlobalLibraryCount(); i++) { + if (!getGlobalLibrary(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 10: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addPathVariable(subBuilder.buildPartial()); + break; + } + case 18: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addGlobalLibrary(subBuilder.buildPartial()); + break; + } + case 26: { + bitField0_ |= 0x00000004; + globalEncoding_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + ignoredFilesPatterns_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // repeated .org.jetbrains.jpsservice.Message.KeyValuePair path_variable = 1; + private java.util.List pathVariable_ = + java.util.Collections.emptyList(); + private void ensurePathVariableIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + pathVariable_ = new java.util.ArrayList(pathVariable_); + bitField0_ |= 0x00000001; + } + } + + public java.util.List getPathVariableList() { + return java.util.Collections.unmodifiableList(pathVariable_); + } + public int getPathVariableCount() { + return pathVariable_.size(); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair getPathVariable(int index) { + return pathVariable_.get(index); + } + public Builder setPathVariable( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePathVariableIsMutable(); + pathVariable_.set(index, value); + + return this; + } + public Builder setPathVariable( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.Builder builderForValue) { + ensurePathVariableIsMutable(); + pathVariable_.set(index, builderForValue.build()); + + return this; + } + public Builder addPathVariable(org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePathVariableIsMutable(); + pathVariable_.add(value); + + return this; + } + public Builder addPathVariable( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePathVariableIsMutable(); + pathVariable_.add(index, value); + + return this; + } + public Builder addPathVariable( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.Builder builderForValue) { + ensurePathVariableIsMutable(); + pathVariable_.add(builderForValue.build()); + + return this; + } + public Builder addPathVariable( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.Builder builderForValue) { + ensurePathVariableIsMutable(); + pathVariable_.add(index, builderForValue.build()); + + return this; + } + public Builder addAllPathVariable( + java.lang.Iterable values) { + ensurePathVariableIsMutable(); + super.addAll(values, pathVariable_); + + return this; + } + public Builder clearPathVariable() { + pathVariable_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + + return this; + } + public Builder removePathVariable(int index) { + ensurePathVariableIsMutable(); + pathVariable_.remove(index); + + return this; + } + + // repeated .org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings.GlobalLibrary global_library = 2; + private java.util.List globalLibrary_ = + java.util.Collections.emptyList(); + private void ensureGlobalLibraryIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + globalLibrary_ = new java.util.ArrayList(globalLibrary_); + bitField0_ |= 0x00000002; + } + } + + public java.util.List getGlobalLibraryList() { + return java.util.Collections.unmodifiableList(globalLibrary_); + } + public int getGlobalLibraryCount() { + return globalLibrary_.size(); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary getGlobalLibrary(int index) { + return globalLibrary_.get(index); + } + public Builder setGlobalLibrary( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary value) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlobalLibraryIsMutable(); + globalLibrary_.set(index, value); + + return this; + } + public Builder setGlobalLibrary( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary.Builder builderForValue) { + ensureGlobalLibraryIsMutable(); + globalLibrary_.set(index, builderForValue.build()); + + return this; + } + public Builder addGlobalLibrary(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary value) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlobalLibraryIsMutable(); + globalLibrary_.add(value); + + return this; + } + public Builder addGlobalLibrary( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary value) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlobalLibraryIsMutable(); + globalLibrary_.add(index, value); + + return this; + } + public Builder addGlobalLibrary( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary.Builder builderForValue) { + ensureGlobalLibraryIsMutable(); + globalLibrary_.add(builderForValue.build()); + + return this; + } + public Builder addGlobalLibrary( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary.Builder builderForValue) { + ensureGlobalLibraryIsMutable(); + globalLibrary_.add(index, builderForValue.build()); + + return this; + } + public Builder addAllGlobalLibrary( + java.lang.Iterable values) { + ensureGlobalLibraryIsMutable(); + super.addAll(values, globalLibrary_); + + return this; + } + public Builder clearGlobalLibrary() { + globalLibrary_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + + return this; + } + public Builder removeGlobalLibrary(int index) { + ensureGlobalLibraryIsMutable(); + globalLibrary_.remove(index); + + return this; + } + + // optional string global_encoding = 3; + private java.lang.Object globalEncoding_ = ""; + public boolean hasGlobalEncoding() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getGlobalEncoding() { + java.lang.Object ref = globalEncoding_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + globalEncoding_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setGlobalEncoding(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + globalEncoding_ = value; + + return this; + } + public Builder clearGlobalEncoding() { + bitField0_ = (bitField0_ & ~0x00000004); + globalEncoding_ = getDefaultInstance().getGlobalEncoding(); + + return this; + } + void setGlobalEncoding(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + globalEncoding_ = value; + + } + + // optional string ignored_files_patterns = 4; + private java.lang.Object ignoredFilesPatterns_ = ""; + public boolean hasIgnoredFilesPatterns() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getIgnoredFilesPatterns() { + java.lang.Object ref = ignoredFilesPatterns_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + ignoredFilesPatterns_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIgnoredFilesPatterns(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + ignoredFilesPatterns_ = value; + + return this; + } + public Builder clearIgnoredFilesPatterns() { + bitField0_ = (bitField0_ & ~0x00000008); + ignoredFilesPatterns_ = getDefaultInstance().getIgnoredFilesPatterns(); + + return this; + } + void setIgnoredFilesPatterns(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + ignoredFilesPatterns_ = value; + + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings) + } + + static { + defaultInstance = new GlobalSettings(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings) + } + + public interface ParametersMessageOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required .org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage.Type build_type = 1; + boolean hasBuildType(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type getBuildType(); + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings global_settings = 2; + boolean hasGlobalSettings(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings getGlobalSettings(); + + // optional string project_id = 3; + boolean hasProjectId(); + String getProjectId(); + + // repeated string module_name = 4; + java.util.List getModuleNameList(); + int getModuleNameCount(); + String getModuleName(int index); + + // repeated string file_path = 5; + java.util.List getFilePathList(); + int getFilePathCount(); + String getFilePath(int index); + + // repeated string artifact_name = 6; + java.util.List getArtifactNameList(); + int getArtifactNameCount(); + String getArtifactName(int index); + + // repeated .org.jetbrains.jpsservice.Message.KeyValuePair builder_parameter = 7; + java.util.List + getBuilderParameterList(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair getBuilderParameter(int index); + int getBuilderParameterCount(); + } + public static final class ParametersMessage extends + com.google.protobuf.GeneratedMessageLite + implements ParametersMessageOrBuilder { + // Use ParametersMessage.newBuilder() to construct. + private ParametersMessage(Builder builder) { + super(builder); + } + private ParametersMessage(boolean noInit) {} + + private static final ParametersMessage defaultInstance; + public static ParametersMessage getDefaultInstance() { + return defaultInstance; + } + + public ParametersMessage getDefaultInstanceForType() { + return defaultInstance; + } + + public enum Type + implements com.google.protobuf.Internal.EnumLite { + REBUILD(0, 1), + MAKE(1, 2), + CLEAN(2, 3), + FORCED_COMPILATION(3, 4), + ; + + public static final int REBUILD_VALUE = 1; + public static final int MAKE_VALUE = 2; + public static final int CLEAN_VALUE = 3; + public static final int FORCED_COMPILATION_VALUE = 4; + + + public final int getNumber() { return value; } + + public static Type valueOf(int value) { + switch (value) { + case 1: return REBUILD; + case 2: return MAKE; + case 3: return CLEAN; + case 4: return FORCED_COMPILATION; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Type findValueByNumber(int number) { + return Type.valueOf(number); + } + }; + + private final int value; + + private Type(int index, int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage.Type) + } + + private int bitField0_; + // required .org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage.Type build_type = 1; + public static final int BUILD_TYPE_FIELD_NUMBER = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type buildType_; + public boolean hasBuildType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type getBuildType() { + return buildType_; + } + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings global_settings = 2; + public static final int GLOBAL_SETTINGS_FIELD_NUMBER = 2; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings globalSettings_; + public boolean hasGlobalSettings() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings getGlobalSettings() { + return globalSettings_; + } + + // optional string project_id = 3; + public static final int PROJECT_ID_FIELD_NUMBER = 3; + private java.lang.Object projectId_; + public boolean hasProjectId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getProjectId() { + java.lang.Object ref = projectId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + projectId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getProjectIdBytes() { + java.lang.Object ref = projectId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + projectId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated string module_name = 4; + public static final int MODULE_NAME_FIELD_NUMBER = 4; + private com.google.protobuf.LazyStringList moduleName_; + public java.util.List + getModuleNameList() { + return moduleName_; + } + public int getModuleNameCount() { + return moduleName_.size(); + } + public String getModuleName(int index) { + return moduleName_.get(index); + } + + // repeated string file_path = 5; + public static final int FILE_PATH_FIELD_NUMBER = 5; + private com.google.protobuf.LazyStringList filePath_; + public java.util.List + getFilePathList() { + return filePath_; + } + public int getFilePathCount() { + return filePath_.size(); + } + public String getFilePath(int index) { + return filePath_.get(index); + } + + // repeated string artifact_name = 6; + public static final int ARTIFACT_NAME_FIELD_NUMBER = 6; + private com.google.protobuf.LazyStringList artifactName_; + public java.util.List + getArtifactNameList() { + return artifactName_; + } + public int getArtifactNameCount() { + return artifactName_.size(); + } + public String getArtifactName(int index) { + return artifactName_.get(index); + } + + // repeated .org.jetbrains.jpsservice.Message.KeyValuePair builder_parameter = 7; + public static final int BUILDER_PARAMETER_FIELD_NUMBER = 7; + private java.util.List builderParameter_; + public java.util.List getBuilderParameterList() { + return builderParameter_; + } + public java.util.List + getBuilderParameterOrBuilderList() { + return builderParameter_; + } + public int getBuilderParameterCount() { + return builderParameter_.size(); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair getBuilderParameter(int index) { + return builderParameter_.get(index); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePairOrBuilder getBuilderParameterOrBuilder( + int index) { + return builderParameter_.get(index); + } + + private void initFields() { + buildType_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type.REBUILD; + globalSettings_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.getDefaultInstance(); + projectId_ = ""; + moduleName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + filePath_ = com.google.protobuf.LazyStringArrayList.EMPTY; + artifactName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + builderParameter_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasBuildType()) { + memoizedIsInitialized = 0; + return false; + } + if (hasGlobalSettings()) { + if (!getGlobalSettings().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getBuilderParameterCount(); i++) { + if (!getBuilderParameter(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, buildType_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, globalSettings_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getProjectIdBytes()); + } + for (int i = 0; i < moduleName_.size(); i++) { + output.writeBytes(4, moduleName_.getByteString(i)); + } + for (int i = 0; i < filePath_.size(); i++) { + output.writeBytes(5, filePath_.getByteString(i)); + } + for (int i = 0; i < artifactName_.size(); i++) { + output.writeBytes(6, artifactName_.getByteString(i)); + } + for (int i = 0; i < builderParameter_.size(); i++) { + output.writeMessage(7, builderParameter_.get(i)); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, buildType_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, globalSettings_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getProjectIdBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < moduleName_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(moduleName_.getByteString(i)); + } + size += dataSize; + size += 1 * getModuleNameList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < filePath_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(filePath_.getByteString(i)); + } + size += dataSize; + size += 1 * getFilePathList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < artifactName_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(artifactName_.getByteString(i)); + } + size += dataSize; + size += 1 * getArtifactNameList().size(); + } + for (int i = 0; i < builderParameter_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, builderParameter_.get(i)); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessageOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + buildType_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type.REBUILD; + bitField0_ = (bitField0_ & ~0x00000001); + globalSettings_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000002); + projectId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + moduleName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + filePath_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + artifactName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000020); + builderParameter_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.buildType_ = buildType_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.globalSettings_ = globalSettings_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.projectId_ = projectId_; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + moduleName_ = new com.google.protobuf.UnmodifiableLazyStringList( + moduleName_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.moduleName_ = moduleName_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + filePath_ = new com.google.protobuf.UnmodifiableLazyStringList( + filePath_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.filePath_ = filePath_; + if (((bitField0_ & 0x00000020) == 0x00000020)) { + artifactName_ = new com.google.protobuf.UnmodifiableLazyStringList( + artifactName_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.artifactName_ = artifactName_; + if (((bitField0_ & 0x00000040) == 0x00000040)) { + builderParameter_ = java.util.Collections.unmodifiableList(builderParameter_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.builderParameter_ = builderParameter_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.getDefaultInstance()) return this; + if (other.hasBuildType()) { + setBuildType(other.getBuildType()); + } + if (other.hasGlobalSettings()) { + mergeGlobalSettings(other.getGlobalSettings()); + } + if (other.hasProjectId()) { + setProjectId(other.getProjectId()); + } + if (!other.moduleName_.isEmpty()) { + if (moduleName_.isEmpty()) { + moduleName_ = other.moduleName_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureModuleNameIsMutable(); + moduleName_.addAll(other.moduleName_); + } + + } + if (!other.filePath_.isEmpty()) { + if (filePath_.isEmpty()) { + filePath_ = other.filePath_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureFilePathIsMutable(); + filePath_.addAll(other.filePath_); + } + + } + if (!other.artifactName_.isEmpty()) { + if (artifactName_.isEmpty()) { + artifactName_ = other.artifactName_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureArtifactNameIsMutable(); + artifactName_.addAll(other.artifactName_); + } + + } + if (!other.builderParameter_.isEmpty()) { + if (builderParameter_.isEmpty()) { + builderParameter_ = other.builderParameter_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureBuilderParameterIsMutable(); + builderParameter_.addAll(other.builderParameter_); + } + + } + return this; + } + + public final boolean isInitialized() { + if (!hasBuildType()) { + + return false; + } + if (hasGlobalSettings()) { + if (!getGlobalSettings().isInitialized()) { + + return false; + } + } + for (int i = 0; i < getBuilderParameterCount(); i++) { + if (!getBuilderParameter(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type value = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type.valueOf(rawValue); + if (value != null) { + bitField0_ |= 0x00000001; + buildType_ = value; + } + break; + } + case 18: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.newBuilder(); + if (hasGlobalSettings()) { + subBuilder.mergeFrom(getGlobalSettings()); + } + input.readMessage(subBuilder, extensionRegistry); + setGlobalSettings(subBuilder.buildPartial()); + break; + } + case 26: { + bitField0_ |= 0x00000004; + projectId_ = input.readBytes(); + break; + } + case 34: { + ensureModuleNameIsMutable(); + moduleName_.add(input.readBytes()); + break; + } + case 42: { + ensureFilePathIsMutable(); + filePath_.add(input.readBytes()); + break; + } + case 50: { + ensureArtifactNameIsMutable(); + artifactName_.add(input.readBytes()); + break; + } + case 58: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addBuilderParameter(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage.Type build_type = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type buildType_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type.REBUILD; + public boolean hasBuildType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type getBuildType() { + return buildType_; + } + public Builder setBuildType(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + buildType_ = value; + + return this; + } + public Builder clearBuildType() { + bitField0_ = (bitField0_ & ~0x00000001); + buildType_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type.REBUILD; + + return this; + } + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage.GlobalSettings global_settings = 2; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings globalSettings_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.getDefaultInstance(); + public boolean hasGlobalSettings() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings getGlobalSettings() { + return globalSettings_; + } + public Builder setGlobalSettings(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings value) { + if (value == null) { + throw new NullPointerException(); + } + globalSettings_ = value; + + bitField0_ |= 0x00000002; + return this; + } + public Builder setGlobalSettings( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.Builder builderForValue) { + globalSettings_ = builderForValue.build(); + + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeGlobalSettings(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings value) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + globalSettings_ != org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.getDefaultInstance()) { + globalSettings_ = + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.newBuilder(globalSettings_).mergeFrom(value).buildPartial(); + } else { + globalSettings_ = value; + } + + bitField0_ |= 0x00000002; + return this; + } + public Builder clearGlobalSettings() { + globalSettings_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + // optional string project_id = 3; + private java.lang.Object projectId_ = ""; + public boolean hasProjectId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getProjectId() { + java.lang.Object ref = projectId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + projectId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setProjectId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + projectId_ = value; + + return this; + } + public Builder clearProjectId() { + bitField0_ = (bitField0_ & ~0x00000004); + projectId_ = getDefaultInstance().getProjectId(); + + return this; + } + void setProjectId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + projectId_ = value; + + } + + // repeated string module_name = 4; + private com.google.protobuf.LazyStringList moduleName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureModuleNameIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + moduleName_ = new com.google.protobuf.LazyStringArrayList(moduleName_); + bitField0_ |= 0x00000008; + } + } + public java.util.List + getModuleNameList() { + return java.util.Collections.unmodifiableList(moduleName_); + } + public int getModuleNameCount() { + return moduleName_.size(); + } + public String getModuleName(int index) { + return moduleName_.get(index); + } + public Builder setModuleName( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureModuleNameIsMutable(); + moduleName_.set(index, value); + + return this; + } + public Builder addModuleName(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureModuleNameIsMutable(); + moduleName_.add(value); + + return this; + } + public Builder addAllModuleName( + java.lang.Iterable values) { + ensureModuleNameIsMutable(); + super.addAll(values, moduleName_); + + return this; + } + public Builder clearModuleName() { + moduleName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + + return this; + } + void addModuleName(com.google.protobuf.ByteString value) { + ensureModuleNameIsMutable(); + moduleName_.add(value); + + } + + // repeated string file_path = 5; + private com.google.protobuf.LazyStringList filePath_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureFilePathIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + filePath_ = new com.google.protobuf.LazyStringArrayList(filePath_); + bitField0_ |= 0x00000010; + } + } + public java.util.List + getFilePathList() { + return java.util.Collections.unmodifiableList(filePath_); + } + public int getFilePathCount() { + return filePath_.size(); + } + public String getFilePath(int index) { + return filePath_.get(index); + } + public Builder setFilePath( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilePathIsMutable(); + filePath_.set(index, value); + + return this; + } + public Builder addFilePath(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilePathIsMutable(); + filePath_.add(value); + + return this; + } + public Builder addAllFilePath( + java.lang.Iterable values) { + ensureFilePathIsMutable(); + super.addAll(values, filePath_); + + return this; + } + public Builder clearFilePath() { + filePath_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + + return this; + } + void addFilePath(com.google.protobuf.ByteString value) { + ensureFilePathIsMutable(); + filePath_.add(value); + + } + + // repeated string artifact_name = 6; + private com.google.protobuf.LazyStringList artifactName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureArtifactNameIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + artifactName_ = new com.google.protobuf.LazyStringArrayList(artifactName_); + bitField0_ |= 0x00000020; + } + } + public java.util.List + getArtifactNameList() { + return java.util.Collections.unmodifiableList(artifactName_); + } + public int getArtifactNameCount() { + return artifactName_.size(); + } + public String getArtifactName(int index) { + return artifactName_.get(index); + } + public Builder setArtifactName( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureArtifactNameIsMutable(); + artifactName_.set(index, value); + + return this; + } + public Builder addArtifactName(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureArtifactNameIsMutable(); + artifactName_.add(value); + + return this; + } + public Builder addAllArtifactName( + java.lang.Iterable values) { + ensureArtifactNameIsMutable(); + super.addAll(values, artifactName_); + + return this; + } + public Builder clearArtifactName() { + artifactName_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000020); + + return this; + } + void addArtifactName(com.google.protobuf.ByteString value) { + ensureArtifactNameIsMutable(); + artifactName_.add(value); + + } + + // repeated .org.jetbrains.jpsservice.Message.KeyValuePair builder_parameter = 7; + private java.util.List builderParameter_ = + java.util.Collections.emptyList(); + private void ensureBuilderParameterIsMutable() { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { + builderParameter_ = new java.util.ArrayList(builderParameter_); + bitField0_ |= 0x00000040; + } + } + + public java.util.List getBuilderParameterList() { + return java.util.Collections.unmodifiableList(builderParameter_); + } + public int getBuilderParameterCount() { + return builderParameter_.size(); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair getBuilderParameter(int index) { + return builderParameter_.get(index); + } + public Builder setBuilderParameter( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBuilderParameterIsMutable(); + builderParameter_.set(index, value); + + return this; + } + public Builder setBuilderParameter( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.Builder builderForValue) { + ensureBuilderParameterIsMutable(); + builderParameter_.set(index, builderForValue.build()); + + return this; + } + public Builder addBuilderParameter(org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBuilderParameterIsMutable(); + builderParameter_.add(value); + + return this; + } + public Builder addBuilderParameter( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBuilderParameterIsMutable(); + builderParameter_.add(index, value); + + return this; + } + public Builder addBuilderParameter( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.Builder builderForValue) { + ensureBuilderParameterIsMutable(); + builderParameter_.add(builderForValue.build()); + + return this; + } + public Builder addBuilderParameter( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.KeyValuePair.Builder builderForValue) { + ensureBuilderParameterIsMutable(); + builderParameter_.add(index, builderForValue.build()); + + return this; + } + public Builder addAllBuilderParameter( + java.lang.Iterable values) { + ensureBuilderParameterIsMutable(); + super.addAll(values, builderParameter_); + + return this; + } + public Builder clearBuilderParameter() { + builderParameter_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + + return this; + } + public Builder removeBuilderParameter(int index) { + ensureBuilderParameterIsMutable(); + builderParameter_.remove(index); + + return this; + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage) + } + + static { + defaultInstance = new ParametersMessage(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage) + } + + private int bitField0_; + // required .org.jetbrains.jpsservice.Message.ControllerMessage.Type type = 1; + public static final int TYPE_FIELD_NUMBER = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type type_; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type getType() { + return type_; + } + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage params_message = 2; + public static final int PARAMS_MESSAGE_FIELD_NUMBER = 2; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage paramsMessage_; + public boolean hasParamsMessage() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage getParamsMessage() { + return paramsMessage_; + } + + private void initFields() { + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type.BUILD_PARAMETERS; + paramsMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + if (hasParamsMessage()) { + if (!getParamsMessage().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, paramsMessage_); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, paramsMessage_); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessageOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type.BUILD_PARAMETERS; + bitField0_ = (bitField0_ & ~0x00000001); + paramsMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.paramsMessage_ = paramsMessage_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.getDefaultInstance()) return this; + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasParamsMessage()) { + mergeParamsMessage(other.getParamsMessage()); + } + return this; + } + + public final boolean isInitialized() { + if (!hasType()) { + + return false; + } + if (hasParamsMessage()) { + if (!getParamsMessage().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type value = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type.valueOf(rawValue); + if (value != null) { + bitField0_ |= 0x00000001; + type_ = value; + } + break; + } + case 18: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.newBuilder(); + if (hasParamsMessage()) { + subBuilder.mergeFrom(getParamsMessage()); + } + input.readMessage(subBuilder, extensionRegistry); + setParamsMessage(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .org.jetbrains.jpsservice.Message.ControllerMessage.Type type = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type.BUILD_PARAMETERS; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type getType() { + return type_; + } + public Builder setType(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + type_ = value; + + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000001); + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Type.BUILD_PARAMETERS; + + return this; + } + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage.ParametersMessage params_message = 2; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage paramsMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.getDefaultInstance(); + public boolean hasParamsMessage() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage getParamsMessage() { + return paramsMessage_; + } + public Builder setParamsMessage(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage value) { + if (value == null) { + throw new NullPointerException(); + } + paramsMessage_ = value; + + bitField0_ |= 0x00000002; + return this; + } + public Builder setParamsMessage( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Builder builderForValue) { + paramsMessage_ = builderForValue.build(); + + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeParamsMessage(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage value) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + paramsMessage_ != org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.getDefaultInstance()) { + paramsMessage_ = + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.newBuilder(paramsMessage_).mergeFrom(value).buildPartial(); + } else { + paramsMessage_ = value; + } + + bitField0_ |= 0x00000002; + return this; + } + public Builder clearParamsMessage() { + paramsMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.ControllerMessage) + } + + static { + defaultInstance = new ControllerMessage(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.ControllerMessage) + } + + public interface BuilderMessageOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required .org.jetbrains.jpsservice.Message.BuilderMessage.Type type = 1; + boolean hasType(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type getType(); + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent build_event = 2; + boolean hasBuildEvent(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent getBuildEvent(); + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage compile_message = 3; + boolean hasCompileMessage(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage getCompileMessage(); + } + public static final class BuilderMessage extends + com.google.protobuf.GeneratedMessageLite + implements BuilderMessageOrBuilder { + // Use BuilderMessage.newBuilder() to construct. + private BuilderMessage(Builder builder) { + super(builder); + } + private BuilderMessage(boolean noInit) {} + + private static final BuilderMessage defaultInstance; + public static BuilderMessage getDefaultInstance() { + return defaultInstance; + } + + public BuilderMessage getDefaultInstanceForType() { + return defaultInstance; + } + + public enum Type + implements com.google.protobuf.Internal.EnumLite { + PARAM_REQUEST(0, 1), + BUILD_EVENT(1, 2), + COMPILE_MESSAGE(2, 3), + ; + + public static final int PARAM_REQUEST_VALUE = 1; + public static final int BUILD_EVENT_VALUE = 2; + public static final int COMPILE_MESSAGE_VALUE = 3; + + + public final int getNumber() { return value; } + + public static Type valueOf(int value) { + switch (value) { + case 1: return PARAM_REQUEST; + case 2: return BUILD_EVENT; + case 3: return COMPILE_MESSAGE; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Type findValueByNumber(int number) { + return Type.valueOf(number); + } + }; + + private final int value; + + private Type(int index, int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.jetbrains.jpsservice.Message.BuilderMessage.Type) + } + + public interface BuildEventOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.Type event_type = 1; + boolean hasEventType(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type getEventType(); + + // optional string description = 2; + boolean hasDescription(); + String getDescription(); + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.Status completion_status = 3; + boolean hasCompletionStatus(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status getCompletionStatus(); + + // repeated .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.GeneratedFile generated_files = 4; + java.util.List + getGeneratedFilesList(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile getGeneratedFiles(int index); + int getGeneratedFilesCount(); + } + public static final class BuildEvent extends + com.google.protobuf.GeneratedMessageLite + implements BuildEventOrBuilder { + // Use BuildEvent.newBuilder() to construct. + private BuildEvent(Builder builder) { + super(builder); + } + private BuildEvent(boolean noInit) {} + + private static final BuildEvent defaultInstance; + public static BuildEvent getDefaultInstance() { + return defaultInstance; + } + + public BuildEvent getDefaultInstanceForType() { + return defaultInstance; + } + + public enum Type + implements com.google.protobuf.Internal.EnumLite { + BUILD_COMPLETED(0, 1), + FILES_GENERATED(1, 2), + ; + + public static final int BUILD_COMPLETED_VALUE = 1; + public static final int FILES_GENERATED_VALUE = 2; + + + public final int getNumber() { return value; } + + public static Type valueOf(int value) { + switch (value) { + case 1: return BUILD_COMPLETED; + case 2: return FILES_GENERATED; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Type findValueByNumber(int number) { + return Type.valueOf(number); + } + }; + + private final int value; + + private Type(int index, int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.Type) + } + + public enum Status + implements com.google.protobuf.Internal.EnumLite { + CANCELED(0, 1), + ERRORS(1, 2), + SUCCESS(2, 3), + UP_TO_DATE(3, 4), + ; + + public static final int CANCELED_VALUE = 1; + public static final int ERRORS_VALUE = 2; + public static final int SUCCESS_VALUE = 3; + public static final int UP_TO_DATE_VALUE = 4; + + + public final int getNumber() { return value; } + + public static Status valueOf(int value) { + switch (value) { + case 1: return CANCELED; + case 2: return ERRORS; + case 3: return SUCCESS; + case 4: return UP_TO_DATE; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Status findValueByNumber(int number) { + return Status.valueOf(number); + } + }; + + private final int value; + + private Status(int index, int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.Status) + } + + public interface GeneratedFileOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required string output_root = 1; + boolean hasOutputRoot(); + String getOutputRoot(); + + // required string relative_path = 2; + boolean hasRelativePath(); + String getRelativePath(); + } + public static final class GeneratedFile extends + com.google.protobuf.GeneratedMessageLite + implements GeneratedFileOrBuilder { + // Use GeneratedFile.newBuilder() to construct. + private GeneratedFile(Builder builder) { + super(builder); + } + private GeneratedFile(boolean noInit) {} + + private static final GeneratedFile defaultInstance; + public static GeneratedFile getDefaultInstance() { + return defaultInstance; + } + + public GeneratedFile getDefaultInstanceForType() { + return defaultInstance; + } + + private int bitField0_; + // required string output_root = 1; + public static final int OUTPUT_ROOT_FIELD_NUMBER = 1; + private java.lang.Object outputRoot_; + public boolean hasOutputRoot() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getOutputRoot() { + java.lang.Object ref = outputRoot_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + outputRoot_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getOutputRootBytes() { + java.lang.Object ref = outputRoot_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + outputRoot_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string relative_path = 2; + public static final int RELATIVE_PATH_FIELD_NUMBER = 2; + private java.lang.Object relativePath_; + public boolean hasRelativePath() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getRelativePath() { + java.lang.Object ref = relativePath_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + relativePath_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getRelativePathBytes() { + java.lang.Object ref = relativePath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + relativePath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + outputRoot_ = ""; + relativePath_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasOutputRoot()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRelativePath()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getOutputRootBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getRelativePathBytes()); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getOutputRootBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getRelativePathBytes()); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFileOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + outputRoot_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + relativePath_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.outputRoot_ = outputRoot_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.relativePath_ = relativePath_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.getDefaultInstance()) return this; + if (other.hasOutputRoot()) { + setOutputRoot(other.getOutputRoot()); + } + if (other.hasRelativePath()) { + setRelativePath(other.getRelativePath()); + } + return this; + } + + public final boolean isInitialized() { + if (!hasOutputRoot()) { + + return false; + } + if (!hasRelativePath()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + outputRoot_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + relativePath_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string output_root = 1; + private java.lang.Object outputRoot_ = ""; + public boolean hasOutputRoot() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getOutputRoot() { + java.lang.Object ref = outputRoot_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + outputRoot_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setOutputRoot(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + outputRoot_ = value; + + return this; + } + public Builder clearOutputRoot() { + bitField0_ = (bitField0_ & ~0x00000001); + outputRoot_ = getDefaultInstance().getOutputRoot(); + + return this; + } + void setOutputRoot(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + outputRoot_ = value; + + } + + // required string relative_path = 2; + private java.lang.Object relativePath_ = ""; + public boolean hasRelativePath() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getRelativePath() { + java.lang.Object ref = relativePath_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + relativePath_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setRelativePath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + relativePath_ = value; + + return this; + } + public Builder clearRelativePath() { + bitField0_ = (bitField0_ & ~0x00000002); + relativePath_ = getDefaultInstance().getRelativePath(); + + return this; + } + void setRelativePath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + relativePath_ = value; + + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.GeneratedFile) + } + + static { + defaultInstance = new GeneratedFile(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.GeneratedFile) + } + + private int bitField0_; + // required .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.Type event_type = 1; + public static final int EVENT_TYPE_FIELD_NUMBER = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type eventType_; + public boolean hasEventType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type getEventType() { + return eventType_; + } + + // optional string description = 2; + public static final int DESCRIPTION_FIELD_NUMBER = 2; + private java.lang.Object description_; + public boolean hasDescription() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + description_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.Status completion_status = 3; + public static final int COMPLETION_STATUS_FIELD_NUMBER = 3; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status completionStatus_; + public boolean hasCompletionStatus() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status getCompletionStatus() { + return completionStatus_; + } + + // repeated .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.GeneratedFile generated_files = 4; + public static final int GENERATED_FILES_FIELD_NUMBER = 4; + private java.util.List generatedFiles_; + public java.util.List getGeneratedFilesList() { + return generatedFiles_; + } + public java.util.List + getGeneratedFilesOrBuilderList() { + return generatedFiles_; + } + public int getGeneratedFilesCount() { + return generatedFiles_.size(); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile getGeneratedFiles(int index) { + return generatedFiles_.get(index); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFileOrBuilder getGeneratedFilesOrBuilder( + int index) { + return generatedFiles_.get(index); + } + + private void initFields() { + eventType_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type.BUILD_COMPLETED; + description_ = ""; + completionStatus_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED; + generatedFiles_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasEventType()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getGeneratedFilesCount(); i++) { + if (!getGeneratedFiles(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, eventType_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getDescriptionBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(3, completionStatus_.getNumber()); + } + for (int i = 0; i < generatedFiles_.size(); i++) { + output.writeMessage(4, generatedFiles_.get(i)); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, eventType_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getDescriptionBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, completionStatus_.getNumber()); + } + for (int i = 0; i < generatedFiles_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, generatedFiles_.get(i)); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEventOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + eventType_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type.BUILD_COMPLETED; + bitField0_ = (bitField0_ & ~0x00000001); + description_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + completionStatus_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED; + bitField0_ = (bitField0_ & ~0x00000004); + generatedFiles_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.eventType_ = eventType_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.description_ = description_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.completionStatus_ = completionStatus_; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + generatedFiles_ = java.util.Collections.unmodifiableList(generatedFiles_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.generatedFiles_ = generatedFiles_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.getDefaultInstance()) return this; + if (other.hasEventType()) { + setEventType(other.getEventType()); + } + if (other.hasDescription()) { + setDescription(other.getDescription()); + } + if (other.hasCompletionStatus()) { + setCompletionStatus(other.getCompletionStatus()); + } + if (!other.generatedFiles_.isEmpty()) { + if (generatedFiles_.isEmpty()) { + generatedFiles_ = other.generatedFiles_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureGeneratedFilesIsMutable(); + generatedFiles_.addAll(other.generatedFiles_); + } + + } + return this; + } + + public final boolean isInitialized() { + if (!hasEventType()) { + + return false; + } + for (int i = 0; i < getGeneratedFilesCount(); i++) { + if (!getGeneratedFiles(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type value = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type.valueOf(rawValue); + if (value != null) { + bitField0_ |= 0x00000001; + eventType_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + description_ = input.readBytes(); + break; + } + case 24: { + int rawValue = input.readEnum(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status value = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.valueOf(rawValue); + if (value != null) { + bitField0_ |= 0x00000004; + completionStatus_ = value; + } + break; + } + case 34: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addGeneratedFiles(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.Type event_type = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type eventType_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type.BUILD_COMPLETED; + public boolean hasEventType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type getEventType() { + return eventType_; + } + public Builder setEventType(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + eventType_ = value; + + return this; + } + public Builder clearEventType() { + bitField0_ = (bitField0_ & ~0x00000001); + eventType_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type.BUILD_COMPLETED; + + return this; + } + + // optional string description = 2; + private java.lang.Object description_ = ""; + public boolean hasDescription() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + description_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setDescription(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + description_ = value; + + return this; + } + public Builder clearDescription() { + bitField0_ = (bitField0_ & ~0x00000002); + description_ = getDefaultInstance().getDescription(); + + return this; + } + void setDescription(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + description_ = value; + + } + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.Status completion_status = 3; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status completionStatus_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED; + public boolean hasCompletionStatus() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status getCompletionStatus() { + return completionStatus_; + } + public Builder setCompletionStatus(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + completionStatus_ = value; + + return this; + } + public Builder clearCompletionStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + completionStatus_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED; + + return this; + } + + // repeated .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent.GeneratedFile generated_files = 4; + private java.util.List generatedFiles_ = + java.util.Collections.emptyList(); + private void ensureGeneratedFilesIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + generatedFiles_ = new java.util.ArrayList(generatedFiles_); + bitField0_ |= 0x00000008; + } + } + + public java.util.List getGeneratedFilesList() { + return java.util.Collections.unmodifiableList(generatedFiles_); + } + public int getGeneratedFilesCount() { + return generatedFiles_.size(); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile getGeneratedFiles(int index) { + return generatedFiles_.get(index); + } + public Builder setGeneratedFiles( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile value) { + if (value == null) { + throw new NullPointerException(); + } + ensureGeneratedFilesIsMutable(); + generatedFiles_.set(index, value); + + return this; + } + public Builder setGeneratedFiles( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.Builder builderForValue) { + ensureGeneratedFilesIsMutable(); + generatedFiles_.set(index, builderForValue.build()); + + return this; + } + public Builder addGeneratedFiles(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile value) { + if (value == null) { + throw new NullPointerException(); + } + ensureGeneratedFilesIsMutable(); + generatedFiles_.add(value); + + return this; + } + public Builder addGeneratedFiles( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile value) { + if (value == null) { + throw new NullPointerException(); + } + ensureGeneratedFilesIsMutable(); + generatedFiles_.add(index, value); + + return this; + } + public Builder addGeneratedFiles( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.Builder builderForValue) { + ensureGeneratedFilesIsMutable(); + generatedFiles_.add(builderForValue.build()); + + return this; + } + public Builder addGeneratedFiles( + int index, org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile.Builder builderForValue) { + ensureGeneratedFilesIsMutable(); + generatedFiles_.add(index, builderForValue.build()); + + return this; + } + public Builder addAllGeneratedFiles( + java.lang.Iterable values) { + ensureGeneratedFilesIsMutable(); + super.addAll(values, generatedFiles_); + + return this; + } + public Builder clearGeneratedFiles() { + generatedFiles_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + + return this; + } + public Builder removeGeneratedFiles(int index) { + ensureGeneratedFilesIsMutable(); + generatedFiles_.remove(index); + + return this; + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent) + } + + static { + defaultInstance = new BuildEvent(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent) + } + + public interface CompileMessageOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // required .org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage.Kind kind = 1; + boolean hasKind(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind getKind(); + + // optional string text = 2; + boolean hasText(); + String getText(); + + // optional string source_file_path = 3; + boolean hasSourceFilePath(); + String getSourceFilePath(); + + // optional uint64 problem_begin_offset = 4; + boolean hasProblemBeginOffset(); + long getProblemBeginOffset(); + + // optional uint64 problem_end_offset = 5; + boolean hasProblemEndOffset(); + long getProblemEndOffset(); + + // optional uint64 problem_location_offset = 6; + boolean hasProblemLocationOffset(); + long getProblemLocationOffset(); + + // optional uint64 line = 7; + boolean hasLine(); + long getLine(); + + // optional uint64 column = 8; + boolean hasColumn(); + long getColumn(); + + // optional float done = 9; + boolean hasDone(); + float getDone(); + } + public static final class CompileMessage extends + com.google.protobuf.GeneratedMessageLite + implements CompileMessageOrBuilder { + // Use CompileMessage.newBuilder() to construct. + private CompileMessage(Builder builder) { + super(builder); + } + private CompileMessage(boolean noInit) {} + + private static final CompileMessage defaultInstance; + public static CompileMessage getDefaultInstance() { + return defaultInstance; + } + + public CompileMessage getDefaultInstanceForType() { + return defaultInstance; + } + + public enum Kind + implements com.google.protobuf.Internal.EnumLite { + ERROR(0, 1), + WARNING(1, 2), + INFO(2, 3), + PROGRESS(3, 4), + ; + + public static final int ERROR_VALUE = 1; + public static final int WARNING_VALUE = 2; + public static final int INFO_VALUE = 3; + public static final int PROGRESS_VALUE = 4; + + + public final int getNumber() { return value; } + + public static Kind valueOf(int value) { + switch (value) { + case 1: return ERROR; + case 2: return WARNING; + case 3: return INFO; + case 4: return PROGRESS; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Kind findValueByNumber(int number) { + return Kind.valueOf(number); + } + }; + + private final int value; + + private Kind(int index, int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage.Kind) + } + + private int bitField0_; + // required .org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage.Kind kind = 1; + public static final int KIND_FIELD_NUMBER = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind kind_; + public boolean hasKind() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind getKind() { + return kind_; + } + + // optional string text = 2; + public static final int TEXT_FIELD_NUMBER = 2; + private java.lang.Object text_; + public boolean hasText() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getText() { + java.lang.Object ref = text_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + text_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTextBytes() { + java.lang.Object ref = text_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + text_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string source_file_path = 3; + public static final int SOURCE_FILE_PATH_FIELD_NUMBER = 3; + private java.lang.Object sourceFilePath_; + public boolean hasSourceFilePath() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getSourceFilePath() { + java.lang.Object ref = sourceFilePath_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + sourceFilePath_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getSourceFilePathBytes() { + java.lang.Object ref = sourceFilePath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + sourceFilePath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional uint64 problem_begin_offset = 4; + public static final int PROBLEM_BEGIN_OFFSET_FIELD_NUMBER = 4; + private long problemBeginOffset_; + public boolean hasProblemBeginOffset() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getProblemBeginOffset() { + return problemBeginOffset_; + } + + // optional uint64 problem_end_offset = 5; + public static final int PROBLEM_END_OFFSET_FIELD_NUMBER = 5; + private long problemEndOffset_; + public boolean hasProblemEndOffset() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getProblemEndOffset() { + return problemEndOffset_; + } + + // optional uint64 problem_location_offset = 6; + public static final int PROBLEM_LOCATION_OFFSET_FIELD_NUMBER = 6; + private long problemLocationOffset_; + public boolean hasProblemLocationOffset() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public long getProblemLocationOffset() { + return problemLocationOffset_; + } + + // optional uint64 line = 7; + public static final int LINE_FIELD_NUMBER = 7; + private long line_; + public boolean hasLine() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public long getLine() { + return line_; + } + + // optional uint64 column = 8; + public static final int COLUMN_FIELD_NUMBER = 8; + private long column_; + public boolean hasColumn() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public long getColumn() { + return column_; + } + + // optional float done = 9; + public static final int DONE_FIELD_NUMBER = 9; + private float done_; + public boolean hasDone() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public float getDone() { + return done_; + } + + private void initFields() { + kind_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR; + text_ = ""; + sourceFilePath_ = ""; + problemBeginOffset_ = 0L; + problemEndOffset_ = 0L; + problemLocationOffset_ = 0L; + line_ = 0L; + column_ = 0L; + done_ = 0F; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasKind()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, kind_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTextBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getSourceFilePathBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeUInt64(4, problemBeginOffset_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeUInt64(5, problemEndOffset_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeUInt64(6, problemLocationOffset_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeUInt64(7, line_); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeUInt64(8, column_); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + output.writeFloat(9, done_); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, kind_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTextBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getSourceFilePathBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(4, problemBeginOffset_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(5, problemEndOffset_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(6, problemLocationOffset_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(7, line_); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(8, column_); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(9, done_); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessageOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + kind_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR; + bitField0_ = (bitField0_ & ~0x00000001); + text_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + sourceFilePath_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + problemBeginOffset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000008); + problemEndOffset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000010); + problemLocationOffset_ = 0L; + bitField0_ = (bitField0_ & ~0x00000020); + line_ = 0L; + bitField0_ = (bitField0_ & ~0x00000040); + column_ = 0L; + bitField0_ = (bitField0_ & ~0x00000080); + done_ = 0F; + bitField0_ = (bitField0_ & ~0x00000100); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.kind_ = kind_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.text_ = text_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.sourceFilePath_ = sourceFilePath_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.problemBeginOffset_ = problemBeginOffset_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.problemEndOffset_ = problemEndOffset_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.problemLocationOffset_ = problemLocationOffset_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.line_ = line_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000080; + } + result.column_ = column_; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000100; + } + result.done_ = done_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.getDefaultInstance()) return this; + if (other.hasKind()) { + setKind(other.getKind()); + } + if (other.hasText()) { + setText(other.getText()); + } + if (other.hasSourceFilePath()) { + setSourceFilePath(other.getSourceFilePath()); + } + if (other.hasProblemBeginOffset()) { + setProblemBeginOffset(other.getProblemBeginOffset()); + } + if (other.hasProblemEndOffset()) { + setProblemEndOffset(other.getProblemEndOffset()); + } + if (other.hasProblemLocationOffset()) { + setProblemLocationOffset(other.getProblemLocationOffset()); + } + if (other.hasLine()) { + setLine(other.getLine()); + } + if (other.hasColumn()) { + setColumn(other.getColumn()); + } + if (other.hasDone()) { + setDone(other.getDone()); + } + return this; + } + + public final boolean isInitialized() { + if (!hasKind()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind value = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.valueOf(rawValue); + if (value != null) { + bitField0_ |= 0x00000001; + kind_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + text_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + sourceFilePath_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + problemBeginOffset_ = input.readUInt64(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + problemEndOffset_ = input.readUInt64(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + problemLocationOffset_ = input.readUInt64(); + break; + } + case 56: { + bitField0_ |= 0x00000040; + line_ = input.readUInt64(); + break; + } + case 64: { + bitField0_ |= 0x00000080; + column_ = input.readUInt64(); + break; + } + case 77: { + bitField0_ |= 0x00000100; + done_ = input.readFloat(); + break; + } + } + } + } + + private int bitField0_; + + // required .org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage.Kind kind = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind kind_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR; + public boolean hasKind() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind getKind() { + return kind_; + } + public Builder setKind(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + kind_ = value; + + return this; + } + public Builder clearKind() { + bitField0_ = (bitField0_ & ~0x00000001); + kind_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR; + + return this; + } + + // optional string text = 2; + private java.lang.Object text_ = ""; + public boolean hasText() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getText() { + java.lang.Object ref = text_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + text_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setText(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + text_ = value; + + return this; + } + public Builder clearText() { + bitField0_ = (bitField0_ & ~0x00000002); + text_ = getDefaultInstance().getText(); + + return this; + } + void setText(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + text_ = value; + + } + + // optional string source_file_path = 3; + private java.lang.Object sourceFilePath_ = ""; + public boolean hasSourceFilePath() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getSourceFilePath() { + java.lang.Object ref = sourceFilePath_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + sourceFilePath_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setSourceFilePath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + sourceFilePath_ = value; + + return this; + } + public Builder clearSourceFilePath() { + bitField0_ = (bitField0_ & ~0x00000004); + sourceFilePath_ = getDefaultInstance().getSourceFilePath(); + + return this; + } + void setSourceFilePath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + sourceFilePath_ = value; + + } + + // optional uint64 problem_begin_offset = 4; + private long problemBeginOffset_ ; + public boolean hasProblemBeginOffset() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getProblemBeginOffset() { + return problemBeginOffset_; + } + public Builder setProblemBeginOffset(long value) { + bitField0_ |= 0x00000008; + problemBeginOffset_ = value; + + return this; + } + public Builder clearProblemBeginOffset() { + bitField0_ = (bitField0_ & ~0x00000008); + problemBeginOffset_ = 0L; + + return this; + } + + // optional uint64 problem_end_offset = 5; + private long problemEndOffset_ ; + public boolean hasProblemEndOffset() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getProblemEndOffset() { + return problemEndOffset_; + } + public Builder setProblemEndOffset(long value) { + bitField0_ |= 0x00000010; + problemEndOffset_ = value; + + return this; + } + public Builder clearProblemEndOffset() { + bitField0_ = (bitField0_ & ~0x00000010); + problemEndOffset_ = 0L; + + return this; + } + + // optional uint64 problem_location_offset = 6; + private long problemLocationOffset_ ; + public boolean hasProblemLocationOffset() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public long getProblemLocationOffset() { + return problemLocationOffset_; + } + public Builder setProblemLocationOffset(long value) { + bitField0_ |= 0x00000020; + problemLocationOffset_ = value; + + return this; + } + public Builder clearProblemLocationOffset() { + bitField0_ = (bitField0_ & ~0x00000020); + problemLocationOffset_ = 0L; + + return this; + } + + // optional uint64 line = 7; + private long line_ ; + public boolean hasLine() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public long getLine() { + return line_; + } + public Builder setLine(long value) { + bitField0_ |= 0x00000040; + line_ = value; + + return this; + } + public Builder clearLine() { + bitField0_ = (bitField0_ & ~0x00000040); + line_ = 0L; + + return this; + } + + // optional uint64 column = 8; + private long column_ ; + public boolean hasColumn() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public long getColumn() { + return column_; + } + public Builder setColumn(long value) { + bitField0_ |= 0x00000080; + column_ = value; + + return this; + } + public Builder clearColumn() { + bitField0_ = (bitField0_ & ~0x00000080); + column_ = 0L; + + return this; + } + + // optional float done = 9; + private float done_ ; + public boolean hasDone() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public float getDone() { + return done_; + } + public Builder setDone(float value) { + bitField0_ |= 0x00000100; + done_ = value; + + return this; + } + public Builder clearDone() { + bitField0_ = (bitField0_ & ~0x00000100); + done_ = 0F; + + return this; + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage) + } + + static { + defaultInstance = new CompileMessage(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage) + } + + private int bitField0_; + // required .org.jetbrains.jpsservice.Message.BuilderMessage.Type type = 1; + public static final int TYPE_FIELD_NUMBER = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type type_; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type getType() { + return type_; + } + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent build_event = 2; + public static final int BUILD_EVENT_FIELD_NUMBER = 2; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent buildEvent_; + public boolean hasBuildEvent() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent getBuildEvent() { + return buildEvent_; + } + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage compile_message = 3; + public static final int COMPILE_MESSAGE_FIELD_NUMBER = 3; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage compileMessage_; + public boolean hasCompileMessage() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage getCompileMessage() { + return compileMessage_; + } + + private void initFields() { + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type.PARAM_REQUEST; + buildEvent_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.getDefaultInstance(); + compileMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + if (hasBuildEvent()) { + if (!getBuildEvent().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasCompileMessage()) { + if (!getCompileMessage().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, buildEvent_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, compileMessage_); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, buildEvent_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, compileMessage_); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessageOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type.PARAM_REQUEST; + bitField0_ = (bitField0_ & ~0x00000001); + buildEvent_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000002); + compileMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.buildEvent_ = buildEvent_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.compileMessage_ = compileMessage_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.getDefaultInstance()) return this; + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasBuildEvent()) { + mergeBuildEvent(other.getBuildEvent()); + } + if (other.hasCompileMessage()) { + mergeCompileMessage(other.getCompileMessage()); + } + return this; + } + + public final boolean isInitialized() { + if (!hasType()) { + + return false; + } + if (hasBuildEvent()) { + if (!getBuildEvent().isInitialized()) { + + return false; + } + } + if (hasCompileMessage()) { + if (!getCompileMessage().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type value = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type.valueOf(rawValue); + if (value != null) { + bitField0_ |= 0x00000001; + type_ = value; + } + break; + } + case 18: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.newBuilder(); + if (hasBuildEvent()) { + subBuilder.mergeFrom(getBuildEvent()); + } + input.readMessage(subBuilder, extensionRegistry); + setBuildEvent(subBuilder.buildPartial()); + break; + } + case 26: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.newBuilder(); + if (hasCompileMessage()) { + subBuilder.mergeFrom(getCompileMessage()); + } + input.readMessage(subBuilder, extensionRegistry); + setCompileMessage(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .org.jetbrains.jpsservice.Message.BuilderMessage.Type type = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type.PARAM_REQUEST; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type getType() { + return type_; + } + public Builder setType(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + type_ = value; + + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000001); + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Type.PARAM_REQUEST; + + return this; + } + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.BuildEvent build_event = 2; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent buildEvent_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.getDefaultInstance(); + public boolean hasBuildEvent() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent getBuildEvent() { + return buildEvent_; + } + public Builder setBuildEvent(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent value) { + if (value == null) { + throw new NullPointerException(); + } + buildEvent_ = value; + + bitField0_ |= 0x00000002; + return this; + } + public Builder setBuildEvent( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Builder builderForValue) { + buildEvent_ = builderForValue.build(); + + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeBuildEvent(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent value) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + buildEvent_ != org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.getDefaultInstance()) { + buildEvent_ = + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.newBuilder(buildEvent_).mergeFrom(value).buildPartial(); + } else { + buildEvent_ = value; + } + + bitField0_ |= 0x00000002; + return this; + } + public Builder clearBuildEvent() { + buildEvent_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage.CompileMessage compile_message = 3; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage compileMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.getDefaultInstance(); + public boolean hasCompileMessage() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage getCompileMessage() { + return compileMessage_; + } + public Builder setCompileMessage(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage value) { + if (value == null) { + throw new NullPointerException(); + } + compileMessage_ = value; + + bitField0_ |= 0x00000004; + return this; + } + public Builder setCompileMessage( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Builder builderForValue) { + compileMessage_ = builderForValue.build(); + + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeCompileMessage(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage value) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + compileMessage_ != org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.getDefaultInstance()) { + compileMessage_ = + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.newBuilder(compileMessage_).mergeFrom(value).buildPartial(); + } else { + compileMessage_ = value; + } + + bitField0_ |= 0x00000004; + return this; + } + public Builder clearCompileMessage() { + compileMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message.BuilderMessage) + } + + static { + defaultInstance = new BuilderMessage(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message.BuilderMessage) + } + + private int bitField0_; + // required .org.jetbrains.jpsservice.Message.UUID session_id = 1; + public static final int SESSION_ID_FIELD_NUMBER = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID sessionId_; + public boolean hasSessionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID getSessionId() { + return sessionId_; + } + + // required .org.jetbrains.jpsservice.Message.Type type = 2; + public static final int TYPE_FIELD_NUMBER = 2; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type type_; + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type getType() { + return type_; + } + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage controller_message = 3; + public static final int CONTROLLER_MESSAGE_FIELD_NUMBER = 3; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage controllerMessage_; + public boolean hasControllerMessage() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage getControllerMessage() { + return controllerMessage_; + } + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage builder_message = 4; + public static final int BUILDER_MESSAGE_FIELD_NUMBER = 4; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage builderMessage_; + public boolean hasBuilderMessage() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage getBuilderMessage() { + return builderMessage_; + } + + // optional .org.jetbrains.jpsservice.Message.Failure failure = 5; + public static final int FAILURE_FIELD_NUMBER = 5; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure failure_; + public boolean hasFailure() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure getFailure() { + return failure_; + } + + private void initFields() { + sessionId_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.getDefaultInstance(); + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type.CONTROLLER_MESSAGE; + controllerMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.getDefaultInstance(); + builderMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.getDefaultInstance(); + failure_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasSessionId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + if (!getSessionId().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (hasControllerMessage()) { + if (!getControllerMessage().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasBuilderMessage()) { + if (!getBuilderMessage().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, sessionId_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(2, type_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, controllerMessage_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, builderMessage_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeMessage(5, failure_); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, sessionId_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(2, type_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, controllerMessage_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, builderMessage_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, failure_); + } + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static org.jetbrains.jps.api.CmdlineRemoteProto.Message parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jps.api.CmdlineRemoteProto.Message prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jps.api.CmdlineRemoteProto.Message, Builder> + implements org.jetbrains.jps.api.CmdlineRemoteProto.MessageOrBuilder { + // Construct using org.jetbrains.jps.api.CmdlineRemoteProto.Message.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + sessionId_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000001); + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type.CONTROLLER_MESSAGE; + bitField0_ = (bitField0_ & ~0x00000002); + controllerMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000004); + builderMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000008); + failure_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message getDefaultInstanceForType() { + return org.jetbrains.jps.api.CmdlineRemoteProto.Message.getDefaultInstance(); + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message build() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private org.jetbrains.jps.api.CmdlineRemoteProto.Message buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + org.jetbrains.jps.api.CmdlineRemoteProto.Message result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public org.jetbrains.jps.api.CmdlineRemoteProto.Message buildPartial() { + org.jetbrains.jps.api.CmdlineRemoteProto.Message result = new org.jetbrains.jps.api.CmdlineRemoteProto.Message(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.sessionId_ = sessionId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.controllerMessage_ = controllerMessage_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.builderMessage_ = builderMessage_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.failure_ = failure_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jps.api.CmdlineRemoteProto.Message other) { + if (other == org.jetbrains.jps.api.CmdlineRemoteProto.Message.getDefaultInstance()) return this; + if (other.hasSessionId()) { + mergeSessionId(other.getSessionId()); + } + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasControllerMessage()) { + mergeControllerMessage(other.getControllerMessage()); + } + if (other.hasBuilderMessage()) { + mergeBuilderMessage(other.getBuilderMessage()); + } + if (other.hasFailure()) { + mergeFailure(other.getFailure()); + } + return this; + } + + public final boolean isInitialized() { + if (!hasSessionId()) { + + return false; + } + if (!hasType()) { + + return false; + } + if (!getSessionId().isInitialized()) { + + return false; + } + if (hasControllerMessage()) { + if (!getControllerMessage().isInitialized()) { + + return false; + } + } + if (hasBuilderMessage()) { + if (!getBuilderMessage().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + + return this; + default: { + if (!parseUnknownField(input, extensionRegistry, tag)) { + + return this; + } + break; + } + case 10: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.newBuilder(); + if (hasSessionId()) { + subBuilder.mergeFrom(getSessionId()); + } + input.readMessage(subBuilder, extensionRegistry); + setSessionId(subBuilder.buildPartial()); + break; + } + case 16: { + int rawValue = input.readEnum(); + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type value = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type.valueOf(rawValue); + if (value != null) { + bitField0_ |= 0x00000002; + type_ = value; + } + break; + } + case 26: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.newBuilder(); + if (hasControllerMessage()) { + subBuilder.mergeFrom(getControllerMessage()); + } + input.readMessage(subBuilder, extensionRegistry); + setControllerMessage(subBuilder.buildPartial()); + break; + } + case 34: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.newBuilder(); + if (hasBuilderMessage()) { + subBuilder.mergeFrom(getBuilderMessage()); + } + input.readMessage(subBuilder, extensionRegistry); + setBuilderMessage(subBuilder.buildPartial()); + break; + } + case 42: { + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.Builder subBuilder = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.newBuilder(); + if (hasFailure()) { + subBuilder.mergeFrom(getFailure()); + } + input.readMessage(subBuilder, extensionRegistry); + setFailure(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .org.jetbrains.jpsservice.Message.UUID session_id = 1; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID sessionId_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.getDefaultInstance(); + public boolean hasSessionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID getSessionId() { + return sessionId_; + } + public Builder setSessionId(org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID value) { + if (value == null) { + throw new NullPointerException(); + } + sessionId_ = value; + + bitField0_ |= 0x00000001; + return this; + } + public Builder setSessionId( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.Builder builderForValue) { + sessionId_ = builderForValue.build(); + + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeSessionId(org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID value) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + sessionId_ != org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.getDefaultInstance()) { + sessionId_ = + org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.newBuilder(sessionId_).mergeFrom(value).buildPartial(); + } else { + sessionId_ = value; + } + + bitField0_ |= 0x00000001; + return this; + } + public Builder clearSessionId() { + sessionId_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.UUID.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + // required .org.jetbrains.jpsservice.Message.Type type = 2; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type.CONTROLLER_MESSAGE; + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type getType() { + return type_; + } + public Builder setType(org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + type_ = value; + + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000002); + type_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Type.CONTROLLER_MESSAGE; + + return this; + } + + // optional .org.jetbrains.jpsservice.Message.ControllerMessage controller_message = 3; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage controllerMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.getDefaultInstance(); + public boolean hasControllerMessage() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage getControllerMessage() { + return controllerMessage_; + } + public Builder setControllerMessage(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage value) { + if (value == null) { + throw new NullPointerException(); + } + controllerMessage_ = value; + + bitField0_ |= 0x00000004; + return this; + } + public Builder setControllerMessage( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.Builder builderForValue) { + controllerMessage_ = builderForValue.build(); + + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeControllerMessage(org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage value) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + controllerMessage_ != org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.getDefaultInstance()) { + controllerMessage_ = + org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.newBuilder(controllerMessage_).mergeFrom(value).buildPartial(); + } else { + controllerMessage_ = value; + } + + bitField0_ |= 0x00000004; + return this; + } + public Builder clearControllerMessage() { + controllerMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + // optional .org.jetbrains.jpsservice.Message.BuilderMessage builder_message = 4; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage builderMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.getDefaultInstance(); + public boolean hasBuilderMessage() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage getBuilderMessage() { + return builderMessage_; + } + public Builder setBuilderMessage(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage value) { + if (value == null) { + throw new NullPointerException(); + } + builderMessage_ = value; + + bitField0_ |= 0x00000008; + return this; + } + public Builder setBuilderMessage( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.Builder builderForValue) { + builderMessage_ = builderForValue.build(); + + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeBuilderMessage(org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage value) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + builderMessage_ != org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.getDefaultInstance()) { + builderMessage_ = + org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.newBuilder(builderMessage_).mergeFrom(value).buildPartial(); + } else { + builderMessage_ = value; + } + + bitField0_ |= 0x00000008; + return this; + } + public Builder clearBuilderMessage() { + builderMessage_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.BuilderMessage.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + // optional .org.jetbrains.jpsservice.Message.Failure failure = 5; + private org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure failure_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.getDefaultInstance(); + public boolean hasFailure() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure getFailure() { + return failure_; + } + public Builder setFailure(org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure value) { + if (value == null) { + throw new NullPointerException(); + } + failure_ = value; + + bitField0_ |= 0x00000010; + return this; + } + public Builder setFailure( + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.Builder builderForValue) { + failure_ = builderForValue.build(); + + bitField0_ |= 0x00000010; + return this; + } + public Builder mergeFailure(org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure value) { + if (((bitField0_ & 0x00000010) == 0x00000010) && + failure_ != org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.getDefaultInstance()) { + failure_ = + org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.newBuilder(failure_).mergeFrom(value).buildPartial(); + } else { + failure_ = value; + } + + bitField0_ |= 0x00000010; + return this; + } + public Builder clearFailure() { + failure_ = org.jetbrains.jps.api.CmdlineRemoteProto.Message.Failure.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jpsservice.Message) + } + + static { + defaultInstance = new Message(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jpsservice.Message) + } + + + static { + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildMain.java b/jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildMain.java new file mode 100644 index 000000000000..a7df294dff3a --- /dev/null +++ b/jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildMain.java @@ -0,0 +1,144 @@ +package org.jetbrains.jps.cmdline; + +import com.intellij.openapi.diagnostic.Logger; +import org.jboss.netty.bootstrap.ClientBootstrap; +import org.jboss.netty.channel.*; +import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; +import org.jboss.netty.handler.codec.protobuf.ProtobufDecoder; +import org.jboss.netty.handler.codec.protobuf.ProtobufEncoder; +import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; +import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import org.jetbrains.jps.api.CmdlineProtoUtil; +import org.jetbrains.jps.api.CmdlineRemoteProto; +import org.jetbrains.jps.api.SharedThreadPool; + +import java.io.File; +import java.net.InetSocketAddress; +import java.util.UUID; + +/** + * @author Eugene Zhuravlev + * Date: 4/16/12 + */ +public class BuildMain { + private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.cmdline.BuildMain"); + + public static void main(String[] args){ + final String host = args[0]; + final int port = Integer.parseInt(args[1]); + final UUID sessionId = UUID.fromString(args[2]); + final File systemDir = new File(args[3]); + systemDir.mkdirs(); + + final ClientBootstrap bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(SharedThreadPool.INSTANCE, SharedThreadPool.INSTANCE, 1)); + bootstrap.setPipelineFactory(new ChannelPipelineFactory() { + public ChannelPipeline getPipeline() throws Exception { + return Channels.pipeline( + new ProtobufVarint32FrameDecoder(), + new ProtobufDecoder(CmdlineRemoteProto.Message.getDefaultInstance()), + new ProtobufVarint32LengthFieldPrepender(), + new ProtobufEncoder(), + new MyMessageHandler(sessionId) + ); + } + }); + bootstrap.setOption("tcpNoDelay", true); + bootstrap.setOption("keepAlive", true); + + final ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port)); + future.awaitUninterruptibly(); + + final boolean success = future.isSuccess(); + + if (success) { + Channels.write(future.getChannel(), CmdlineProtoUtil.toMessage(sessionId, CmdlineProtoUtil.createParamRequest())); + } + else { + final Throwable reason = future.getCause(); + if (reason != null) { + System.err.println("Error connecting to " + host + ":" + port + "; " + reason.getMessage()); + reason.printStackTrace(System.err); + } + System.exit(-1); + } + } + + private static class MyMessageHandler extends SimpleChannelHandler { + private final UUID mySessionId; + private volatile BuildSession mySession; + + private MyMessageHandler(UUID sessionId) { + mySessionId = sessionId; + } + + @Override + public void messageReceived(final ChannelHandlerContext ctx, MessageEvent e) throws Exception { + CmdlineRemoteProto.Message message = (CmdlineRemoteProto.Message)e.getMessage(); + final CmdlineRemoteProto.Message.Type type = message.getType(); + + if (type == CmdlineRemoteProto.Message.Type.CONTROLLER_MESSAGE) { + final CmdlineRemoteProto.Message.ControllerMessage controllerMessage = message.getControllerMessage(); + switch (controllerMessage.getType()) { + + case BUILD_PARAMETERS: + if (mySession == null) { + final BuildSession session = new BuildSession(mySessionId, ctx.getChannel(), controllerMessage.getParamsMessage()); + mySession = session; + SharedThreadPool.INSTANCE.submit(session); + } + else { + LOG.info("Cannot start another build session because one is already running"); + } + return; + + case CANCEL_BUILD_COMMAND: + final BuildSession session = mySession; + if (session != null) { + session.cancel(); + } + else { + LOG.info("Cannot cancel build: no build session is running"); + closeChannel(ctx.getChannel()); + } + return; + } + } + + Channels.write(ctx.getChannel(), CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createFailure("Unsupported message type: " + type.name(), null))); + } + + @Override + public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { + try { + super.channelClosed(ctx, e); + } + finally { + SharedThreadPool.INSTANCE.submit(new Runnable() { + @Override + public void run() { + System.exit(0); + } + }); + } + } + + @Override + public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { + try { + super.channelDisconnected(ctx, e); + } + finally { + closeChannel(ctx.getChannel()); + } + } + } + + private static void closeChannel(final Channel channel) { + SharedThreadPool.INSTANCE.submit(new Runnable() { + @Override + public void run() { + channel.close().awaitUninterruptibly(); + } + }); + } +} diff --git a/jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildSession.java b/jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildSession.java new file mode 100644 index 000000000000..77d616fd1f78 --- /dev/null +++ b/jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildSession.java @@ -0,0 +1,406 @@ +package org.jetbrains.jps.cmdline; + +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.Ref; +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.text.StringUtil; +import groovy.util.Node; +import groovy.util.XmlParser; +import org.codehaus.groovy.runtime.MethodClosure; +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelFutureListener; +import org.jboss.netty.channel.Channels; +import org.jetbrains.jps.Library; +import org.jetbrains.jps.Module; +import org.jetbrains.jps.Project; +import org.jetbrains.jps.Sdk; +import org.jetbrains.jps.api.*; +import org.jetbrains.jps.artifacts.Artifact; +import org.jetbrains.jps.idea.IdeaProjectLoader; +import org.jetbrains.jps.idea.SystemOutErrorReporter; +import org.jetbrains.jps.incremental.*; +import org.jetbrains.jps.incremental.messages.*; +import org.jetbrains.jps.incremental.storage.BuildDataManager; +import org.jetbrains.jps.incremental.storage.ProjectTimestamps; +import org.jetbrains.jps.incremental.storage.TimestampStorage; +import org.jetbrains.jps.server.ProjectDescriptor; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.PrintStream; +import java.util.*; + +/** +* @author Eugene Zhuravlev +* Date: 4/17/12 +*/ +final class BuildSession implements Runnable, CanceledStatus { + private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.cmdline.BuildSession"); + public static final String IDEA_PROJECT_DIRNAME = ".idea"; + private final UUID mySessionId; + private final Channel myChannel; + private volatile boolean myCanceled = false; + // globals + private final Map myPathVars; + private final List myGlobalLibraries; + private final String myGlobalEncoding; + private final String myIgnorePatterns; + // build params + private final BuildType myBuildType; + private final Set myModules; + private final List myArtifacts; + private final List myFilePaths; + private final Map myBuilderParams; + private String myProjectPath; + + // todo pass FSState in order not to scan FS from scratch + + BuildSession(UUID sessionId, Channel channel, CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage params) { + mySessionId = sessionId; + myChannel = channel; + + // globals + myPathVars = new HashMap(); + final CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings globals = params.getGlobalSettings(); + for (CmdlineRemoteProto.Message.KeyValuePair variable : globals.getPathVariableList()) { + myPathVars.put(variable.getKey(), variable.getValue()); + } + myGlobalLibraries = new ArrayList(); + for (CmdlineRemoteProto.Message.ControllerMessage.GlobalSettings.GlobalLibrary library : globals.getGlobalLibraryList()) { + myGlobalLibraries.add( + library.hasHomePath() ? + new SdkLibrary(library.getName(), library.getTypeName(), library.hasVersion() ? library.getVersion() : null, library.getHomePath(), library.getPathList(), library.hasAdditionalDataXml() ? library.getAdditionalDataXml() : null) : + new GlobalLibrary(library.getName(), library.getPathList()) + ); + } + myGlobalEncoding = globals.hasGlobalEncoding()? globals.getGlobalEncoding() : null; + myIgnorePatterns = globals.hasIgnoredFilesPatterns()? globals.getIgnoredFilesPatterns() : null; + + // session params + myProjectPath = FileUtil.toCanonicalPath(params.getProjectId()); + myBuildType = convertCompileType(params.getBuildType()); + myModules = new HashSet(params.getModuleNameList()); + myArtifacts = params.getArtifactNameList(); + myFilePaths = params.getFilePathList(); + myBuilderParams = new HashMap(); + for (CmdlineRemoteProto.Message.KeyValuePair pair : params.getBuilderParameterList()) { + myBuilderParams.put(pair.getKey(), pair.getValue()); + } + } + + public void run() { + Throwable error = null; + final Ref hasErrors = new Ref(false); + final Ref markedFilesUptodate = new Ref(false); + try { + runBuild(myProjectPath, myBuildType, myModules, myArtifacts, myBuilderParams, myFilePaths, new MessageHandler() { + public void processMessage(BuildMessage buildMessage) { + final CmdlineRemoteProto.Message.BuilderMessage response; + if (buildMessage instanceof FileGeneratedEvent) { + final Collection> paths = ((FileGeneratedEvent)buildMessage).getPaths(); + response = !paths.isEmpty() ? CmdlineProtoUtil.createFileGeneratedEvent(paths) : null; + } + else if (buildMessage instanceof UptoDateFilesSavedEvent) { + markedFilesUptodate.set(true); + response = null; + } + else if (buildMessage instanceof CompilerMessage) { + markedFilesUptodate.set(true); + final CompilerMessage compilerMessage = (CompilerMessage)buildMessage; + final String text = compilerMessage.getCompilerName() + ": " + compilerMessage.getMessageText(); + final BuildMessage.Kind kind = compilerMessage.getKind(); + if (kind == BuildMessage.Kind.ERROR) { + hasErrors.set(true); + } + response = CmdlineProtoUtil.createCompileMessageResponse( + kind, text, compilerMessage.getSourcePath(), + compilerMessage.getProblemBeginOffset(), compilerMessage.getProblemEndOffset(), + compilerMessage.getProblemLocationOffset(), compilerMessage.getLine(), compilerMessage.getColumn(), + -1.0f); + } + else { + float done = -1.0f; + if (buildMessage instanceof ProgressMessage) { + done = ((ProgressMessage)buildMessage).getDone(); + } + response = CmdlineProtoUtil.createCompileProgressMessageResponse(buildMessage.getMessageText(), done); + } + if (response != null) { + Channels.write(myChannel, CmdlineProtoUtil.toMessage(mySessionId, response)); + } + } + }, this); + } + catch (Throwable e) { + LOG.info(e); + error = e; + } + finally { + finishBuild(error, hasErrors.get(), markedFilesUptodate.get()); + } + } + + private void runBuild(String projectPath, BuildType buildType, Set modules, Collection artifacts, Map builderParams, Collection paths, final MessageHandler msgHandler, CanceledStatus cs) throws Throwable{ + ProjectDescriptor pd; + final Project project = loadProject(projectPath); + final FSState fsState = new FSState(false); + ProjectTimestamps timestamps = null; + BuildDataManager dataManager = null; + final File dataStorageRoot = Utils.getDataStorageRoot(project); + try { + timestamps = new ProjectTimestamps(dataStorageRoot); + dataManager = new BuildDataManager(dataStorageRoot, true); + } + catch (Exception e) { + // second try + e.printStackTrace(System.err); + if (timestamps != null) { + timestamps.close(); + } + if (dataManager != null) { + dataManager.close(); + } + buildType = BuildType.PROJECT_REBUILD; // force project rebuild + FileUtil.delete(dataStorageRoot); + timestamps = new ProjectTimestamps(dataStorageRoot); + dataManager = new BuildDataManager(dataStorageRoot, true); + // second attempt succeded + msgHandler.processMessage(new CompilerMessage("compile-server", BuildMessage.Kind.INFO, "Project rebuild forced: " + e.getMessage())); + } + + pd = new ProjectDescriptor(project, fsState, timestamps, dataManager, BuildLoggingManager.DEFAULT); + + try { + final CompileScope compileScope = createCompilationScope(buildType, pd, modules, artifacts, paths); + final IncProjectBuilder builder = new IncProjectBuilder(pd, BuilderRegistry.getInstance(), builderParams, cs); + if (msgHandler != null) { + builder.addMessageHandler(msgHandler); + } + switch (buildType) { + case PROJECT_REBUILD: + builder.build(compileScope, false, true); + break; + + case FORCED_COMPILATION: + builder.build(compileScope, false, false); + break; + + case MAKE: + builder.build(compileScope, true, false); + break; + + case CLEAN: + //todo[nik] + // new ProjectBuilder(new GantBinding(), project).clean(); + break; + } + } + finally { + pd.release(); + } + } + + private void finishBuild(Throwable error, boolean hadBuildErrors, boolean markedUptodateFiles) { + CmdlineRemoteProto.Message lastMessage = null; + try { + if (error != null) { + Throwable cause = error.getCause(); + if (cause == null) { + cause = error; + } + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + cause.printStackTrace(new PrintStream(out)); + + final StringBuilder messageText = new StringBuilder(); + messageText.append("Internal error: (").append(cause.getClass().getName()).append(") ").append(cause.getMessage()); + final String trace = out.toString(); + if (!trace.isEmpty()) { + messageText.append("\n").append(trace); + } + lastMessage = CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createFailure(messageText.toString(), cause)); + } + else { + CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status status = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.SUCCESS; + if (myCanceled) { + status = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED; + } + else if (hadBuildErrors) { + status = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.ERRORS; + } + else if (!markedUptodateFiles){ + status = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.UP_TO_DATE; + } + lastMessage = CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createBuildCompletedEvent("build completed", status)); + } + } + catch (Throwable e) { + lastMessage = CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createFailure(e.getMessage(), e)); + } + finally { + Channels.write(myChannel, lastMessage).addListener(new ChannelFutureListener() { + public void operationComplete(ChannelFuture future) throws Exception { + SharedThreadPool.INSTANCE.submit(new Runnable() { + @Override + public void run() { + final ChannelFuture closeFuture = myChannel.close(); + closeFuture.awaitUninterruptibly(); + } + }); + } + }); + } + } + + public void cancel() { + myCanceled = true; + } + + @Override + public boolean isCanceled() { + return myCanceled; + } + + + private Project loadProject(String projectPath) { + final long start = System.currentTimeMillis(); + try { + final Project project = new Project(); + // setup JDKs and global libraries + final MethodClosure fakeClosure = new MethodClosure(new Object(), "hashCode"); + for (GlobalLibrary library : myGlobalLibraries) { + if (library instanceof SdkLibrary) { + final SdkLibrary sdk = (SdkLibrary)library; + Node additionalData = null; + final String additionalXml = sdk.getAdditionalDataXml(); + if (additionalXml != null) { + try { + additionalData = new XmlParser(false, false).parseText(additionalXml); + } + catch (Exception e) { + LOG.info(e); + } + } + final Sdk jdk = project.createSdk(sdk.getTypeName(), sdk.getName(), sdk.getVersion(), sdk.getHomePath(), additionalData); + if (jdk != null) { + jdk.setClasspath(sdk.getPaths()); + } + else { + LOG.info("Failed to load SDK " + sdk.getName() + ", type: " + sdk.getTypeName()); + } + } + else { + final Library lib = project.createGlobalLibrary(library.getName(), fakeClosure); + if (lib != null) { + lib.setClasspath(library.getPaths()); + } + else { + LOG.info("Failed to load global library " + library.getName()); + } + } + } + + final File projectFile = new File(projectPath); + + //String root = dirBased ? projectPath : projectFile.getParent(); + + final String loadPath = isDirectoryBased(projectFile) ? new File(projectFile, IDEA_PROJECT_DIRNAME).getPath() : projectPath; + IdeaProjectLoader.loadFromPath(project, loadPath, myPathVars, null, new SystemOutErrorReporter(false)); + final String globalEncoding = myGlobalEncoding; + if (globalEncoding != null && project.getProjectCharset() == null) { + project.setProjectCharset(globalEncoding); + } + project.getIgnoredFilePatterns().loadFromString(myIgnorePatterns); + return project; + } + finally { + final long loadTime = System.currentTimeMillis() - start; + LOG.info("Project " + projectPath + " loaded in " + loadTime + " ms"); + } + } + + private static boolean isDirectoryBased(File projectFile) { + return !(projectFile.isFile() && projectFile.getName().endsWith(".ipr")); + } + + private static CompileScope createCompilationScope(BuildType buildType, ProjectDescriptor pd, Set modules, Collection artifactNames, Collection paths) throws Exception { + Set artifacts = new HashSet(); + if (artifactNames.isEmpty() && buildType == BuildType.PROJECT_REBUILD) { + artifacts.addAll(pd.project.getArtifacts().values()); + } + else { + final Map artifactMap = pd.project.getArtifacts(); + for (String name : artifactNames) { + final Artifact artifact = artifactMap.get(name); + if (artifact != null && !StringUtil.isEmpty(artifact.getOutputPath())) { + artifacts.add(artifact); + } + } + } + + final CompileScope compileScope; + if (buildType == BuildType.PROJECT_REBUILD || (modules.isEmpty() && paths.isEmpty())) { + compileScope = new AllProjectScope(pd.project, artifacts, buildType != BuildType.MAKE); + } + else { + final Set forcedModules; + if (!modules.isEmpty()) { + forcedModules = new HashSet(); + for (Module m : pd.project.getModules().values()) { + if (modules.contains(m.getName())) { + forcedModules.add(m); + } + } + } + else { + forcedModules = Collections.emptySet(); + } + + final TimestampStorage tsStorage = pd.timestamps.getStorage(); + + final Map> filesToCompile; + if (!paths.isEmpty()) { + filesToCompile = new HashMap>(); + for (String path : paths) { + final File file = new File(path); + final RootDescriptor rd = pd.rootsIndex.getModuleAndRoot(file); + if (rd != null) { + Set files = filesToCompile.get(rd.module); + if (files == null) { + files = new HashSet(); + filesToCompile.put(rd.module, files); + } + files.add(file); + if (buildType == BuildType.FORCED_COMPILATION) { + pd.fsState.markDirty(file, rd, tsStorage); + } + } + } + } + else { + filesToCompile = Collections.emptyMap(); + } + + if (filesToCompile.isEmpty()) { + compileScope = new ModulesScope(pd.project, forcedModules, artifacts, buildType != BuildType.MAKE); + } + else { + compileScope = new ModulesAndFilesScope(pd.project, forcedModules, filesToCompile, artifacts, buildType != BuildType.MAKE); + } + } + return compileScope; + } + + + private static BuildType convertCompileType(CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.Type compileType) { + switch (compileType) { + case CLEAN: return BuildType.CLEAN; + case MAKE: return BuildType.MAKE; + case REBUILD: return BuildType.PROJECT_REBUILD; + case FORCED_COMPILATION: return BuildType.FORCED_COMPILATION; + } + return BuildType.MAKE; // use make by default + } + +} From 15dcad7d869fe7ba4f791e7a2464089bcc59b877 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 17 Apr 2012 20:51:14 +0200 Subject: [PATCH 40/44] IDEA-70226, IDEA-73261 (detect and work-around non-supported WMs) --- .../com/intellij/idea/IdeaApplication.java | 84 +++++++++++++++++-- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java index 97930bafdabf..ba971f8f8fe9 100644 --- a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java +++ b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java @@ -41,6 +41,7 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.WindowManager; import com.intellij.openapi.wm.impl.WindowManagerImpl; import com.intellij.ui.Splash; +import com.intellij.util.SystemProperties; import com.intellij.util.messages.MessageBus; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; @@ -48,32 +49,36 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.Arrays; - @SuppressWarnings({"CallToPrintStackTrace"}) public class IdeaApplication { + @NonNls public static final String IDEA_IS_INTERNAL_PROPERTY = "idea.is.internal"; + private static final Logger LOG = Logger.getInstance("#com.intellij.idea.IdeaApplication"); + private static IdeaApplication ourInstance; + protected final String[] myArgs; private boolean myPerformProjectLoad = true; - private static IdeaApplication ourInstance; private ApplicationStarter myStarter; - @NonNls public static final String IDEA_IS_INTERNAL_PROPERTY = "idea.is.internal"; public IdeaApplication(String[] args) { LOG.assertTrue(ourInstance == null); + //noinspection AssignmentToStaticFieldFromInstanceMethod ourInstance = this; + myArgs = args; boolean isInternal = Boolean.valueOf(System.getProperty(IDEA_IS_INTERNAL_PROPERTY)).booleanValue(); if (Main.isCommandLine(args)) { boolean headless = Main.isHeadless(args); - new CommandLineApplication(isInternal, false, headless); if (!headless) patchSystem(); + new CommandLineApplication(isInternal, false, headless); } else { - System.setProperty("sun.awt.noerasebackground","true"); patchSystem(); Splash splash = null; if (myArgs.length == 0) { @@ -90,16 +95,82 @@ public class IdeaApplication { } private static void patchSystem() { + System.setProperty("sun.awt.noerasebackground","true"); + Toolkit.getDefaultToolkit().getSystemEventQueue().push(IdeEventQueue.getInstance()); + if (Patches.SUN_BUG_ID_6209673) { RepaintManager.setCurrentManager(new IdeRepaintManager()); } + + patchWM(); + IconLoader.activate(); } + private static void patchWM() { + if (SystemProperties.getBooleanProperty("idea.skip.wm.patching", false)) return; + if (!"sun.awt.X11.XToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) return; + + try { + final Class xwmClass = Class.forName("sun.awt.X11.XWM"); + final Method getWM = xwmClass.getDeclaredMethod("getWM"); + getWM.setAccessible(true); + final Object xwm = getWM.invoke(null); + if (xwm == null) return; + + final Method getNetProtocol = xwmClass.getDeclaredMethod("getNETProtocol"); + getNetProtocol.setAccessible(true); + final Object netProtocol = getNetProtocol.invoke(xwm); + if (netProtocol == null) return; + + final Method getWMName = netProtocol.getClass().getDeclaredMethod("getWMName"); + getWMName.setAccessible(true); + final String wmName = (String)getWMName.invoke(netProtocol); + if (wmName == null) return; + LOG.info("WM detected: " + wmName); + + if ("Mutter".equals(wmName)) { + try { + xwmClass.getDeclaredField("MUTTER_WM"); + } + catch (NoSuchFieldException e) { + setWM(xwm, "METACITY_WM"); // Mutter support absent - mimic Metacity + } + } + else if ("awesome".equals(wmName)) { + try { + xwmClass.getDeclaredField("OTHER_NONREPARENTING_WM"); + if (System.getenv("_JAVA_AWT_WM_NONREPARENTING") == null) { + setWM(xwm, "OTHER_NONREPARENTING_WM"); // patch present but not activated + } + } + catch (NoSuchFieldException e) { + setWM(xwm, "LG3D_WM"); // patch absent - mimic LG3D + } + } + } + catch (Throwable e) { + LOG.warn(e); + } + } + + private static void setWM(final Object xwm, final String wmConstant) throws NoSuchFieldException, IllegalAccessException { + final Field wm = xwm.getClass().getDeclaredField(wmConstant); + wm.setAccessible(true); + final Object id = wm.get(null); + if (id != null) { + final Field awtWmgr = xwm.getClass().getDeclaredField("awt_wmgr"); + awtWmgr.setAccessible(true); + awtWmgr.set(null, id); + final Field wmID = xwm.getClass().getDeclaredField("WMID"); + wmID.setAccessible(true); + wmID.set(xwm, id); + } + } + protected ApplicationStarter getStarter() { if (myArgs.length > 0) { - final Application app = ApplicationManager.getApplication(); PluginManager.getPlugins(); ExtensionPoint point = Extensions.getRootArea().getExtensionPoint(ExtensionPoints.APPLICATION_STARTER); @@ -224,6 +295,7 @@ public class IdeaApplication { } } + //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { public void run() { PluginManager.reportPluginError(); From 5a888001d3edf448fa9163ec78da7eed94c63579 Mon Sep 17 00:00:00 2001 From: "kirill.safonov" Date: Sun, 15 Apr 2012 08:08:37 +0400 Subject: [PATCH 41/44] all capitals in dialog title --- .../history/wholeTree/ContainedInBranchesConfigDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/ContainedInBranchesConfigDialog.java b/plugins/git4idea/src/git4idea/history/wholeTree/ContainedInBranchesConfigDialog.java index a11acba0f45e..2afeca80c063 100644 --- a/plugins/git4idea/src/git4idea/history/wholeTree/ContainedInBranchesConfigDialog.java +++ b/plugins/git4idea/src/git4idea/history/wholeTree/ContainedInBranchesConfigDialog.java @@ -48,7 +48,7 @@ public class ContainedInBranchesConfigDialog extends DialogWrapper { Collection remoteBranches, final String currentLocal, final String currentRemote) { super(project, true); myProject = project; - setTitle("Configure branches presentation"); + setTitle("Configure Branches Presentation"); initUi(project, localBranches, remoteBranches, currentLocal, currentRemote); Disposer.register(myProject, getDisposable()); init(); From f4939d27712961f2a11cdb630635512f8c42dcd8 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 18 Apr 2012 09:08:44 +0200 Subject: [PATCH 42/44] export inspection results: catch exception to proceed with other inspections --- .../codeInspection/ex/GlobalInspectionContextImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java index 18d9ef0bc84e..36e27ed70db5 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -337,7 +337,12 @@ public class GlobalInspectionContextImpl extends UserDataHolderBase implements G for (Element element : globalTools.keySet()) { final Tools tools = globalTools.get(element); for (ScopeToolState state : tools.getTools()) { - ((InspectionTool)state.getTool()).exportResults(element, refEntity); + try { + ((InspectionTool)state.getTool()).exportResults(element, refEntity); + } + catch (Exception e) { + LOG.error(e); + } } } } From c16ac8d1864db445851d392a80e0985610905986 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 18 Apr 2012 09:13:36 +0200 Subject: [PATCH 43/44] inspections: avoid getElement() calls --- .../codeInspection/deadCode/UnusedDeclarationInspection.java | 2 +- .../codeInspection/ex/DescriptorProviderInspection.java | 2 +- .../src/com/intellij/codeInspection/ex/InspectionTool.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java index 6968e8ff5f9f..d4d740f832b7 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java @@ -644,7 +644,7 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool { final RefElement refElement = (RefElement)refEntity; final HighlightSeverity severity = getCurrentSeverity(refElement); final String attributeKey = - getTextAttributeKey(refElement.getElement().getProject(), severity, ProblemHighlightType.LIKE_UNUSED_SYMBOL); + getTextAttributeKey(refElement.getRefManager().getProject(), severity, ProblemHighlightType.LIKE_UNUSED_SYMBOL); problemClassElement.setAttribute("severity", severity.myName); problemClassElement.setAttribute("attribute_key", attributeKey); } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorProviderInspection.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorProviderInspection.java index 36c4d93b92a7..12812e249899 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorProviderInspection.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/DescriptorProviderInspection.java @@ -290,7 +290,7 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem ProblemHighlightType problemHighlightType = description instanceof ProblemDescriptor ? ((ProblemDescriptor)description).getHighlightType() : ProblemHighlightType.GENERIC_ERROR_OR_WARNING; - final String attributeKey = getTextAttributeKey(refElement.getElement().getProject(), severity, problemHighlightType); + final String attributeKey = getTextAttributeKey(refElement.getRefManager().getProject(), severity, problemHighlightType); problemClassElement.setAttribute("severity", severity.myName); problemClassElement.setAttribute("attribute_key", attributeKey); } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionTool.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionTool.java index e9d0aa00349d..9ecf87d5e620 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionTool.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionTool.java @@ -168,7 +168,7 @@ public abstract class InspectionTool extends InspectionProfileEntry { } protected HighlightSeverity getCurrentSeverity(RefElement element) { - final PsiElement psiElement = element.getElement(); + final PsiElement psiElement = element.getPointer().getContainingFile(); if (psiElement != null) { if (myContext != null) { final Tools tools = myContext.getTools().get(getShortName()); From 4328612df80dabdf4ec02c062cdc9745cfb6d143 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 18 Apr 2012 10:16:29 +0200 Subject: [PATCH 44/44] export inspection results: logging --- .../intellij/codeInspection/ex/GlobalInspectionContextImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java index 36e27ed70db5..34c5757bc028 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -341,7 +341,7 @@ public class GlobalInspectionContextImpl extends UserDataHolderBase implements G ((InspectionTool)state.getTool()).exportResults(element, refEntity); } catch (Exception e) { - LOG.error(e); + LOG.error("Problem when exporting: " + refEntity.getExternalName(), e); } } }