mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
IJPL-797 intellij.platform.jps.build.javac.rt review internal API
GitOrigin-RevId: 946f83227ef510e0b8e0eeb53f821480c6aa4595
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9db2a6ec5c
commit
9d7db9822d
File diff suppressed because it is too large
Load Diff
162
jps/jps-builders-6/api-dump.txt
Normal file
162
jps/jps-builders-6/api-dump.txt
Normal file
@@ -0,0 +1,162 @@
|
||||
org.jetbrains.jps.api.CanceledStatus
|
||||
- sf:NULL:org.jetbrains.jps.api.CanceledStatus
|
||||
- a:isCanceled():Z
|
||||
f:org.jetbrains.jps.builders.impl.java.JavacCompilerTool
|
||||
- org.jetbrains.jps.builders.java.JavaCompilingTool
|
||||
- sf:ALTERNATIVE_ID:java.lang.String
|
||||
- sf:ID:java.lang.String
|
||||
- <init>():V
|
||||
- createCompiler():javax.tools.JavaCompiler
|
||||
- getAdditionalClasspath():java.util.List
|
||||
- getAlternativeId():java.lang.String
|
||||
- getDefaultCompilerOptions():java.util.List
|
||||
- getDescription():java.lang.String
|
||||
- getId():java.lang.String
|
||||
- isCompilerTreeAPISupported():Z
|
||||
f:org.jetbrains.jps.builders.java.CannotCreateJavaCompilerException
|
||||
- java.lang.Exception
|
||||
- <init>(java.lang.String):V
|
||||
a:org.jetbrains.jps.builders.java.JavaCompilingTool
|
||||
- <init>():V
|
||||
- a:createCompiler():javax.tools.JavaCompiler
|
||||
- a:getAdditionalClasspath():java.util.List
|
||||
- getAlternativeId():java.lang.String
|
||||
- getDefaultCompilerOptions():java.util.List
|
||||
- a:getDescription():java.lang.String
|
||||
- a:getId():java.lang.String
|
||||
- isCompilerTreeAPISupported():Z
|
||||
- preprocessOptions(java.util.List):V
|
||||
a:org.jetbrains.jps.builders.java.JavaSourceTransformer
|
||||
- <init>():V
|
||||
- s:getTransformers():java.util.Collection
|
||||
- a:transform(java.io.File,java.lang.CharSequence):java.lang.CharSequence
|
||||
a:org.jetbrains.jps.builders.java.JavaSourceTransformer$TransformError
|
||||
- java.io.IOException
|
||||
- p:<init>(java.lang.String):V
|
||||
- p:<init>(java.lang.String,java.lang.Throwable):V
|
||||
- p:<init>(java.lang.Throwable):V
|
||||
f:org.jetbrains.jps.incremental.BinaryContent
|
||||
- <init>(B[]):V
|
||||
- <init>(B[],I,I):V
|
||||
- getBuffer():B[]
|
||||
- getLength():I
|
||||
- getOffset():I
|
||||
- saveToFile(java.io.File):V
|
||||
- toByteArray():B[]
|
||||
f:org.jetbrains.jps.javac.APIWrappers
|
||||
- <init>():V
|
||||
- s:unwrap(java.lang.Class,java.lang.Object):java.lang.Object
|
||||
a:org.jetbrains.jps.javac.AbstractRefCollectorCompilerToolExtension
|
||||
- org.jetbrains.jps.javac.JavaCompilerToolExtension
|
||||
- <init>():V
|
||||
- f:beforeCompileTaskExecution(org.jetbrains.jps.builders.java.JavaCompilingTool,javax.tools.JavaCompiler$CompilationTask,java.lang.Iterable,org.jetbrains.jps.javac.DiagnosticOutputConsumer):V
|
||||
- pa:isEnabled():Z
|
||||
org.jetbrains.jps.javac.DiagnosticOutputConsumer
|
||||
- javax.tools.DiagnosticListener
|
||||
- a:customOutputData(java.lang.String,java.lang.String,B[]):V
|
||||
- a:javaFileLoaded(java.io.File):V
|
||||
- a:outputLineAvailable(java.lang.String):V
|
||||
- a:registerJavacFileData(org.jetbrains.jps.javac.ast.api.JavacFileData):V
|
||||
f:org.jetbrains.jps.javac.ExternalRefCollectorCompilerToolExtension
|
||||
- org.jetbrains.jps.javac.AbstractRefCollectorCompilerToolExtension
|
||||
- sf:ENABLED_PARAM:java.lang.String
|
||||
- <init>():V
|
||||
f:org.jetbrains.jps.javac.Iterators
|
||||
- <init>():V
|
||||
- s:asIterable(java.lang.Object):java.lang.Iterable
|
||||
- s:asIterable(java.lang.Object[]):java.lang.Iterable
|
||||
- s:asIterator(java.lang.Iterable):java.util.Iterator
|
||||
- s:asIterator(java.lang.Object):java.util.Iterator
|
||||
- s:collect(java.lang.Iterable,java.util.Collection):java.util.Collection
|
||||
- s:contains(java.lang.Iterable,java.lang.Object):Z
|
||||
- s:count(java.lang.Iterable):I
|
||||
- s:equals(java.lang.Iterable,java.lang.Iterable):Z
|
||||
- s:equals(java.lang.Iterable,java.lang.Iterable,org.jetbrains.jps.javac.Iterators$BiFunction):Z
|
||||
- s:filter(java.lang.Iterable,org.jetbrains.jps.javac.Iterators$BooleanFunction):java.lang.Iterable
|
||||
- s:filter(java.util.Iterator,org.jetbrains.jps.javac.Iterators$BooleanFunction):java.util.Iterator
|
||||
- s:filterWithOrder(java.lang.Iterable,java.lang.Iterable):java.lang.Iterable
|
||||
- s:filterWithOrder(java.util.Iterator,java.util.Iterator):java.util.Iterator
|
||||
- s:find(java.lang.Iterable,org.jetbrains.jps.javac.Iterators$BooleanFunction):java.lang.Object
|
||||
- s:flat(java.lang.Iterable):java.lang.Iterable
|
||||
- s:flat(java.lang.Iterable,java.lang.Iterable):java.lang.Iterable
|
||||
- s:flat(java.util.Collection):java.lang.Iterable
|
||||
- s:flat(java.util.Iterator):java.util.Iterator
|
||||
- s:flat(java.util.Iterator,java.util.Iterator):java.util.Iterator
|
||||
- s:hashCode(java.lang.Iterable):I
|
||||
- s:isEmpty(java.lang.Iterable):Z
|
||||
- s:isEmptyCollection(java.lang.Iterable):Z
|
||||
- s:lazy(org.jetbrains.jps.javac.Iterators$Provider):java.lang.Iterable
|
||||
- s:map(java.lang.Iterable,org.jetbrains.jps.javac.Iterators$Function):java.lang.Iterable
|
||||
- s:map(java.util.Iterator,org.jetbrains.jps.javac.Iterators$Function):java.util.Iterator
|
||||
- s:notNullFilter():org.jetbrains.jps.javac.Iterators$BooleanFunction
|
||||
- s:recurse(java.lang.Object,org.jetbrains.jps.javac.Iterators$Function,Z):java.lang.Iterable
|
||||
- s:recurseDepth(java.lang.Object,org.jetbrains.jps.javac.Iterators$Function,Z):java.lang.Iterable
|
||||
- s:reverse(java.util.List):java.lang.Iterable
|
||||
- s:unique(java.lang.Iterable):java.lang.Iterable
|
||||
- s:unique(java.util.Iterator):java.util.Iterator
|
||||
- s:uniqueBy(java.lang.Iterable,org.jetbrains.jps.javac.Iterators$Provider):java.lang.Iterable
|
||||
org.jetbrains.jps.javac.Iterators$BiFunction
|
||||
- a:fun(java.lang.Object,java.lang.Object):java.lang.Object
|
||||
org.jetbrains.jps.javac.Iterators$BooleanFunction
|
||||
- a:fun(java.lang.Object):Z
|
||||
org.jetbrains.jps.javac.Iterators$Function
|
||||
- a:fun(java.lang.Object):java.lang.Object
|
||||
org.jetbrains.jps.javac.Iterators$Provider
|
||||
- a:get():java.lang.Object
|
||||
a:org.jetbrains.jps.javac.JavaCompilerToolExtension
|
||||
- <init>():V
|
||||
- beforeCompileTaskExecution(org.jetbrains.jps.builders.java.JavaCompilingTool,javax.tools.JavaCompiler$CompilationTask,java.lang.Iterable,org.jetbrains.jps.javac.DiagnosticOutputConsumer):V
|
||||
- s:getExtensions():java.util.Collection
|
||||
a:org.jetbrains.jps.javac.JpsFileObject
|
||||
- javax.tools.SimpleJavaFileObject
|
||||
- <init>(java.net.URI,javax.tools.JavaFileObject$Kind,javax.tools.JavaFileManager$Location):V
|
||||
- equals(java.lang.Object):Z
|
||||
- ps:findKind(java.lang.String):javax.tools.JavaFileObject$Kind
|
||||
- getLocation():javax.tools.JavaFileManager$Location
|
||||
- hashCode():I
|
||||
- pa:inferBinaryName(java.lang.Iterable,Z):java.lang.String
|
||||
- ps:loadCharContent(java.io.File,java.lang.String):java.lang.CharSequence
|
||||
- openReader(Z):java.io.Reader
|
||||
f:org.jetbrains.jps.javac.JpsInfoDiagnostic
|
||||
- org.jetbrains.jps.javac.PlainMessageDiagnostic
|
||||
- <init>(java.lang.String):V
|
||||
a:org.jetbrains.jps.javac.ModulePath
|
||||
- sf:EMPTY:org.jetbrains.jps.javac.ModulePath
|
||||
- <init>():V
|
||||
- s:create(java.util.Collection):org.jetbrains.jps.javac.ModulePath
|
||||
- a:getModuleName(java.io.File):java.lang.String
|
||||
- a:getPath():java.util.Collection
|
||||
- isEmpty():Z
|
||||
- s:newBuilder():org.jetbrains.jps.javac.ModulePath$Builder
|
||||
org.jetbrains.jps.javac.ModulePath$Builder
|
||||
- a:add(java.lang.String,java.io.File):org.jetbrains.jps.javac.ModulePath$Builder
|
||||
- a:create():org.jetbrains.jps.javac.ModulePath
|
||||
org.jetbrains.jps.javac.OutputFileConsumer
|
||||
- a:save(org.jetbrains.jps.javac.OutputFileObject):V
|
||||
f:org.jetbrains.jps.javac.OutputFileObject
|
||||
- org.jetbrains.jps.javac.JpsFileObject
|
||||
- getCharContent(Z):java.lang.CharSequence
|
||||
- getClassName():java.lang.String
|
||||
- getContent():org.jetbrains.jps.incremental.BinaryContent
|
||||
- getFile():java.io.File
|
||||
- getOutputRoot():java.io.File
|
||||
- getRelativePath():java.lang.String
|
||||
- getSourceFiles():java.lang.Iterable
|
||||
- getSourceUris():java.lang.Iterable
|
||||
- isGenerated():Z
|
||||
- openInputStream():java.io.InputStream
|
||||
- openOutputStream():java.io.ByteArrayOutputStream
|
||||
- openWriter():java.io.Writer
|
||||
- updateContent(B[]):V
|
||||
c:org.jetbrains.jps.javac.PlainMessageDiagnostic
|
||||
- javax.tools.Diagnostic
|
||||
- <init>(javax.tools.Diagnostic$Kind,java.lang.String):V
|
||||
- getCode():java.lang.String
|
||||
- getColumnNumber():J
|
||||
- getEndPosition():J
|
||||
- getKind():javax.tools.Diagnostic$Kind
|
||||
- getLineNumber():J
|
||||
- getMessage(java.util.Locale):java.lang.String
|
||||
- getPosition():J
|
||||
- getSource():javax.tools.JavaFileObject
|
||||
- getStartPosition():J
|
||||
@@ -1,38 +1,10 @@
|
||||
com/google/protobuf/ByteString
|
||||
com/google/protobuf/CodedInputStream
|
||||
com/google/protobuf/CodedOutputStream
|
||||
com/google/protobuf/Descriptors$Descriptor
|
||||
com/google/protobuf/Descriptors$EnumDescriptor
|
||||
com/google/protobuf/Descriptors$EnumValueDescriptor
|
||||
com/google/protobuf/Descriptors$FieldDescriptor
|
||||
com/google/protobuf/Descriptors$FileDescriptor
|
||||
com/google/protobuf/Descriptors$OneofDescriptor
|
||||
com/google/protobuf/ExtensionRegistry
|
||||
com/google/protobuf/ExtensionRegistryLite
|
||||
com/google/protobuf/GeneratedMessageV3
|
||||
com/google/protobuf/GeneratedMessageV3$Builder
|
||||
com/google/protobuf/Internal$EnumLiteMap
|
||||
com/google/protobuf/Message
|
||||
com/google/protobuf/MessageLite
|
||||
com/google/protobuf/MessageOrBuilder
|
||||
com/google/protobuf/Parser
|
||||
com/google/protobuf/ProtocolMessageEnum
|
||||
com/google/protobuf/ProtocolStringList
|
||||
com/google/protobuf/UnknownFieldSet
|
||||
javax/annotation/processing/ProcessingEnvironment
|
||||
javax/annotation/processing/Processor
|
||||
javax/lang/model/element/Modifier
|
||||
javax/lang/model/element/NestingKind
|
||||
javax/tools/Diagnostic
|
||||
javax/tools/Diagnostic$Kind
|
||||
javax/tools/DiagnosticListener
|
||||
javax/tools/FileObject
|
||||
javax/tools/ForwardingJavaFileManager
|
||||
javax/tools/JavaCompiler
|
||||
javax/tools/JavaCompiler$CompilationTask
|
||||
javax/tools/JavaFileManager$Location
|
||||
javax/tools/JavaFileObject
|
||||
javax/tools/JavaFileObject$Kind
|
||||
javax/tools/SimpleJavaFileObject
|
||||
javax/tools/StandardJavaFileManager
|
||||
org/jetbrains/jps/javac/ast/api/JavacFileData
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
@ApiStatus.Internal
|
||||
package org.jetbrains.jps.javac.rpc;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -2,7 +2,7 @@ syntax = "proto2";
|
||||
|
||||
package org.jetbrains.javac;
|
||||
|
||||
option java_package = "org.jetbrains.jps.javac";
|
||||
option java_package = "org.jetbrains.jps.javac.rpc";
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
message Message {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -8,9 +9,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public final class ExtensionsSupport<T> {
|
||||
private final Class<T> myExtensionClass;
|
||||
private volatile List<T> myCached;
|
||||
|
||||
@@ -1,23 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public interface CanceledStatus {
|
||||
CanceledStatus NULL = new CanceledStatus() {
|
||||
@Override
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.builders.java;
|
||||
|
||||
import org.jetbrains.jps.ExtensionsSupport;
|
||||
@@ -6,9 +7,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public abstract class JavaSourceTransformer {
|
||||
|
||||
public static abstract class TransformError extends IOException {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import java.io.File;
|
||||
@@ -21,9 +7,6 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public final class BinaryContent {
|
||||
private final byte[] myBuffer;
|
||||
private final int myOffset;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.nio.CharBuffer;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public abstract class LineOutputWriter extends Writer {
|
||||
private final LineParser myLineParser = new LineParser();
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public final class SingleCharSequence implements CharSequence {
|
||||
final class SingleCharSequence implements CharSequence {
|
||||
private final char myCh;
|
||||
|
||||
public SingleCharSequence(char ch) {
|
||||
SingleCharSequence(char ch) {
|
||||
myCh = ch;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.javac.Iterators.Function;
|
||||
@@ -44,10 +45,12 @@ public final class APIWrappers {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static <T extends FileObject> DiagnosticOutputConsumer newDiagnosticListenerWrapper(ProcessingContext procContext, final DiagnosticOutputConsumer delegate) {
|
||||
return wrap(DiagnosticOutputConsumer.class, new DiagnosticListenerWrapper<T>(procContext, delegate));
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static class ProcessingContext {
|
||||
private final JpsJavacFileManager myFileManager;
|
||||
private Iterable<Processor> myAllProcessors = Collections.emptyList();
|
||||
@@ -81,7 +84,7 @@ public final class APIWrappers {
|
||||
myLastProcName = getProcessorName(proc);
|
||||
}
|
||||
|
||||
public Iterable<Processor> wrapProcessors(Iterable<? extends Processor> processors) {
|
||||
Iterable<Processor> wrapProcessors(Iterable<? extends Processor> processors) {
|
||||
return myAllProcessors = Iterators.map(processors, new Function<Processor, Processor>() {
|
||||
@Override
|
||||
public Processor fun(Processor processor) {
|
||||
@@ -123,7 +126,7 @@ public final class APIWrappers {
|
||||
}
|
||||
}
|
||||
|
||||
public interface WrapperDelegateAccessor<T> {
|
||||
interface WrapperDelegateAccessor<T> {
|
||||
T getWrapperDelegate();
|
||||
}
|
||||
|
||||
@@ -351,6 +354,7 @@ public final class APIWrappers {
|
||||
return wrap(ifaceClass, wrapper, DynamicWrapper.class, wrapper.getWrapperDelegate());
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NotNull
|
||||
public static <T> T wrap(@NotNull Class<T> ifaceClass, @NotNull final Object wrapper, @NotNull final Class<?> parentToStopSearchAt, @NotNull final T delegateTo) {
|
||||
return ifaceClass.cast(Proxy.newProxyInstance(APIWrappers.class.getClassLoader(), new Class<?>[]{ifaceClass, WrapperDelegateAccessor.class}, new InvocationHandler() {
|
||||
@@ -449,7 +453,7 @@ public final class APIWrappers {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUnwrapCodeSuggestion(Class<?> ifaceClass, String objVarName) {
|
||||
private static String getUnwrapCodeSuggestion(Class<?> ifaceClass, String objVarName) {
|
||||
return ifaceClass.getSimpleName() + " unwrapped" + objVarName + " = " + "jbUnwrap(" + ifaceClass.getSimpleName() + ".class, " + objVarName + ");" +
|
||||
"\n\n\t\twhere\n\n" +
|
||||
"private static <T> T jbUnwrap(Class<? extends T> iface, T wrapper) {\n" +
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
final class CompilationCanceledException extends RuntimeException{
|
||||
CompilationCanceledException() {
|
||||
super("Compilation canceled");
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.jps.javac.ast.api.JavacFileData;
|
||||
@@ -21,12 +7,13 @@ import javax.tools.DiagnosticListener;
|
||||
import javax.tools.JavaFileObject;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public interface DiagnosticOutputConsumer extends DiagnosticListener<JavaFileObject> {
|
||||
|
||||
void outputLineAvailable(String line);
|
||||
|
||||
void registerJavacFileData(JavacFileData data);
|
||||
|
||||
void javaFileLoaded(File file);
|
||||
|
||||
void customOutputData(String pluginId, String dataName, byte[] data);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import javax.lang.model.element.NestingKind;
|
||||
import javax.tools.*;
|
||||
import javax.tools.JavaFileObject;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
final class DummyJavaFileObject implements JavaFileObject {
|
||||
// todo: use proxy to handle possible interface changes?
|
||||
private final URI myUri;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.MessageLite;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.BinaryContent;
|
||||
import org.jetbrains.jps.javac.rpc.JavacRemoteProto;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileManager;
|
||||
@@ -17,9 +19,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public final class ExternalJavacMessageHandler {
|
||||
private final DiagnosticOutputConsumer myDiagnosticSink;
|
||||
private final OutputFileConsumer myOutputSink;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
@@ -11,11 +11,13 @@ import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import io.netty.util.internal.logging.JdkLoggerFactory;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.api.CanceledStatus;
|
||||
import org.jetbrains.jps.builders.impl.java.JavacCompilerTool;
|
||||
import org.jetbrains.jps.builders.java.JavaCompilingTool;
|
||||
import org.jetbrains.jps.javac.ast.api.JavacFileData;
|
||||
import org.jetbrains.jps.javac.rpc.JavacRemoteProto;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileObject;
|
||||
@@ -25,6 +27,7 @@ import java.util.concurrent.*;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.*;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class ExternalJavacProcess {
|
||||
public static final String JPS_JAVA_COMPILING_TOOL_PROPERTY = "jps.java.compiling.tool";
|
||||
public static final int MINIMUM_REQUIRED_JAVA_VERSION = 7;
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.jps.javac.Iterators.BooleanFunction;
|
||||
import org.jetbrains.jps.javac.Iterators.Function;
|
||||
|
||||
import javax.tools.*;
|
||||
import javax.tools.JavaFileObject;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public final class FileObjectKindFilter<T> {
|
||||
final class FileObjectKindFilter<T> {
|
||||
private final Function<? super T, String> myToNameConverter;
|
||||
private final Map<JavaFileObject.Kind, BooleanFunction<T>> myFilterMap;
|
||||
|
||||
public FileObjectKindFilter(Function<? super T, String> toNameConverter) {
|
||||
FileObjectKindFilter(Function<? super T, String> toNameConverter) {
|
||||
myToNameConverter = toNameConverter;
|
||||
final Map<JavaFileObject.Kind, BooleanFunction<T>> filterMap = new EnumMap<>(JavaFileObject.Kind.class);
|
||||
for (final JavaFileObject.Kind kind : JavaFileObject.Kind.values()) {
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.tools.*;
|
||||
import javax.tools.JavaFileManager;
|
||||
import javax.tools.JavaFileObject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Abstract some file operations that can be differently implemented depending on the JVM version
|
||||
*
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public interface FileOperations {
|
||||
interface FileOperations {
|
||||
interface Archive {
|
||||
@NotNull
|
||||
Iterable<JavaFileObject> list(String relPath, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
@@ -8,7 +8,7 @@ import javax.tools.JavaFileObject;
|
||||
import javax.tools.StandardLocation;
|
||||
import java.io.*;
|
||||
|
||||
public final class InputFileObject extends JpsFileObject {
|
||||
final class InputFileObject extends JpsFileObject {
|
||||
private final File myFile;
|
||||
private final String myEncoding;
|
||||
private final ValueSupplier<File, RuntimeException> myAbsFile;
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -22,9 +8,6 @@ import org.jetbrains.jps.builders.java.JavaCompilingTool;
|
||||
import javax.tools.JavaCompiler;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public abstract class JavaCompilerToolExtension {
|
||||
/**
|
||||
* This method is called before compiler task execution.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -21,9 +22,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public final class JavacMain {
|
||||
//private static final boolean ECLIPSE_COMPILER_SINGLE_THREADED_MODE = Boolean.parseBoolean(System.getProperty("jdt.compiler.useSingleThread", "false"));
|
||||
private static final Set<String> FILTERED_OPTIONS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.BinaryContent;
|
||||
import org.jetbrains.jps.javac.rpc.JavacRemoteProto;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileManager;
|
||||
@@ -15,9 +17,7 @@ import java.io.PrintStream;
|
||||
import java.net.URI;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public final class JavacProtoUtil {
|
||||
public static JavacRemoteProto.Message.Request createCancelRequest() {
|
||||
return JavacRemoteProto.Message.Request.newBuilder().setRequestType(JavacRemoteProto.Message.Request.Type.CANCEL).build();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -10,9 +10,6 @@ import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.nio.CharBuffer;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public abstract class JpsFileObject extends SimpleJavaFileObject {
|
||||
private static final Kind[] ourAvailableKinds = Kind.values();
|
||||
private final JavaFileManager.Location myLocation;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -19,9 +20,7 @@ import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public final class JpsJavacFileManager extends ForwardingJavaFileManager<StandardJavaFileManager> implements StandardJavaFileManager {
|
||||
private static final String _OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
|
||||
private static final boolean isWindows = _OS_NAME.startsWith("windows");
|
||||
@@ -334,6 +333,7 @@ public final class JpsJavacFileManager extends ForwardingJavaFileManager<Standar
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public interface Context {
|
||||
@Nullable
|
||||
String getExplodedAutomaticModuleName(File pathElement);
|
||||
@@ -348,7 +348,7 @@ public final class JpsJavacFileManager extends ForwardingJavaFileManager<Standar
|
||||
void reportMessage(final Diagnostic.Kind kind, @Nls String message);
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
Context getContext() {
|
||||
return myContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public interface OutputFileConsumer {
|
||||
void save(@NotNull OutputFileObject fileObject);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
@@ -7,13 +7,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.BinaryContent;
|
||||
import org.jetbrains.jps.javac.Iterators.Function;
|
||||
|
||||
import javax.tools.*;
|
||||
import javax.tools.JavaFileManager;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public final class OutputFileObject extends JpsFileObject {
|
||||
@Nullable
|
||||
private final JpsJavacFileManager.Context myContext;
|
||||
@@ -28,7 +25,7 @@ public final class OutputFileObject extends JpsFileObject {
|
||||
private final String myEncodingName;
|
||||
private final boolean myIsGenerated;
|
||||
|
||||
public OutputFileObject(@Nullable JpsJavacFileManager.Context context,
|
||||
OutputFileObject(@Nullable JpsJavacFileManager.Context context,
|
||||
@Nullable File outputRoot,
|
||||
String relativePath,
|
||||
@NotNull File file,
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.annotations.Nls;
|
||||
@@ -21,9 +7,6 @@ import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileObject;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public class PlainMessageDiagnostic implements Diagnostic<JavaFileObject>{
|
||||
private final Kind myKind;
|
||||
@Nls
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import org.jetbrains.jps.builders.java.JavaSourceTransformer;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import javax.lang.model.element.NestingKind;
|
||||
import javax.tools.*;
|
||||
import javax.tools.JavaFileObject;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public final class TransformableJavaFileObject implements JavaFileObject {
|
||||
final class TransformableJavaFileObject implements JavaFileObject {
|
||||
private final JavaFileObject myOriginal;
|
||||
private final Collection<? extends JavaSourceTransformer> myTransformers;
|
||||
|
||||
public TransformableJavaFileObject(JavaFileObject original, Collection<? extends JavaSourceTransformer> transformers) {
|
||||
TransformableJavaFileObject(JavaFileObject original, Collection<? extends JavaSourceTransformer> transformers) {
|
||||
myOriginal = original;
|
||||
myTransformers = transformers;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public abstract class ValueSupplier<T, E extends Throwable> {
|
||||
abstract class ValueSupplier<T, E extends Throwable> {
|
||||
|
||||
public abstract T get() throws E;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.javac;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.tools.JavaFileManager;
|
||||
@@ -12,6 +13,7 @@ import java.nio.CharBuffer;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class ZipFileObject extends JpsFileObject {
|
||||
private final ZipFile myZip;
|
||||
private final ZipEntry myEntry;
|
||||
|
||||
@@ -2694,18 +2694,6 @@ f:org.jetbrains.jps.cache.statistics.SystemOpsStatistic
|
||||
- getConnectionSpeedBytesPerSec():J
|
||||
- getDecompressionSpeedBytesPesSec():J
|
||||
- getDeletionSpeedBytesPerSec():J
|
||||
org.jetbrains.jps.client.ProtobufResponseHandler
|
||||
- a:handleMessage(com.google.protobuf.MessageLite):Z
|
||||
- a:sessionTerminated():V
|
||||
f:org.jetbrains.jps.client.SimpleProtobufClient
|
||||
- <init>(com.google.protobuf.MessageLite,java.util.concurrent.Executor,org.jetbrains.jps.client.UUIDGetter):V
|
||||
- checkConnected():V
|
||||
- connect(java.lang.String,I):Z
|
||||
- disconnect():V
|
||||
- isConnected():Z
|
||||
- sendMessage(java.util.UUID,com.google.protobuf.MessageLite,org.jetbrains.jps.client.ProtobufResponseHandler,org.jetbrains.jps.api.RequestFuture$CancelAction):org.jetbrains.jps.api.RequestFuture
|
||||
org.jetbrains.jps.client.UUIDGetter
|
||||
- a:getSessionUUID(org.jetbrains.jps.javac.JavacRemoteProto$Message):java.util.UUID
|
||||
f:org.jetbrains.jps.cmdline.BuildMain
|
||||
- <init>():V
|
||||
- s:main(java.lang.String[]):V
|
||||
|
||||
@@ -6,7 +6,6 @@ com/google/protobuf/GeneratedMessageLite$Builder
|
||||
com/google/protobuf/Internal$EnumLite
|
||||
com/google/protobuf/Internal$EnumLiteMap
|
||||
com/google/protobuf/Internal$EnumVerifier
|
||||
com/google/protobuf/MessageLite
|
||||
com/google/protobuf/MessageLiteOrBuilder
|
||||
com/google/protobuf/Parser
|
||||
com/intellij/compiler/instrumentation/InstrumentationClassFinder
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.client;
|
||||
|
||||
import com.google.protobuf.MessageLite;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.api.RequestFuture;
|
||||
import org.jetbrains.jps.javac.JavacRemoteProto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
@ChannelHandler.Sharable
|
||||
final class ProtobufClientMessageHandler<T extends ProtobufResponseHandler> extends SimpleChannelInboundHandler<MessageLite> {
|
||||
private final ConcurrentMap<UUID, RequestFuture<T>> myHandlers = new ConcurrentHashMap<>(16, 0.75f, 1);
|
||||
private final @NotNull UUIDGetter myUuidGetter;
|
||||
private final SimpleProtobufClient myClient;
|
||||
private final Executor myAsyncExec;
|
||||
|
||||
ProtobufClientMessageHandler(@NotNull UUIDGetter uuidGetter, SimpleProtobufClient client, Executor asyncExec) {
|
||||
myUuidGetter = uuidGetter;
|
||||
myClient = client;
|
||||
myAsyncExec = asyncExec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext context, MessageLite message) throws Exception {
|
||||
final UUID messageUUID = myUuidGetter.getSessionUUID((JavacRemoteProto.Message)message);
|
||||
final RequestFuture<T> future = myHandlers.get(messageUUID);
|
||||
final T handler = future != null ? future.getMessageHandler() : null;
|
||||
if (handler == null) {
|
||||
terminateSession(messageUUID);
|
||||
}
|
||||
else {
|
||||
boolean terminateSession = false;
|
||||
try {
|
||||
terminateSession = handler.handleMessage(message);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
terminateSession = true;
|
||||
throw ex;
|
||||
}
|
||||
finally {
|
||||
if (terminateSession) {
|
||||
terminateSession(messageUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void terminateSession(UUID sessionId) {
|
||||
final RequestFuture<T> future = removeFuture(sessionId);
|
||||
if (future != null) {
|
||||
final T handler = future.getMessageHandler();
|
||||
try {
|
||||
if (handler != null) {
|
||||
try {
|
||||
handler.sessionTerminated();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
//noinspection CallToPrintStackTrace
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
future.setDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext context) throws Exception {
|
||||
try {
|
||||
super.channelInactive(context);
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
//invoke 'keySet()' method via 'Map' class because ConcurrentHashMap#keySet() has return type ('KeySetView') which doesn't exist in JDK 1.6/1.7
|
||||
Set<UUID> keys = myHandlers.keySet();
|
||||
|
||||
for (UUID uuid : new ArrayList<>(keys)) {
|
||||
terminateSession(uuid);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// make sure the client is in disconnected state
|
||||
myAsyncExec.execute(() -> myClient.disconnect());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void registerFuture(UUID messageId, RequestFuture<T> requestFuture) {
|
||||
myHandlers.put(messageId, requestFuture);
|
||||
}
|
||||
|
||||
public RequestFuture<T> removeFuture(UUID messageId) {
|
||||
return myHandlers.remove(messageId);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.client;
|
||||
|
||||
import com.google.protobuf.MessageLite;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public interface ProtobufResponseHandler {
|
||||
|
||||
/**
|
||||
* @return true if session should be terminated, false otherwise
|
||||
*/
|
||||
boolean handleMessage(MessageLite message);
|
||||
|
||||
void sessionTerminated();
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.jps.client;
|
||||
|
||||
import com.google.protobuf.MessageLite;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.handler.codec.protobuf.ProtobufDecoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufEncoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.api.RequestFuture;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public final class SimpleProtobufClient<T extends ProtobufResponseHandler> {
|
||||
private static final Logger LOG = Logger.getInstance(SimpleProtobufClient.class);
|
||||
|
||||
private enum State {
|
||||
DISCONNECTED, CONNECTING, CONNECTED, DISCONNECTING
|
||||
}
|
||||
|
||||
private final AtomicReference<State> myState = new AtomicReference<>(State.DISCONNECTED);
|
||||
private final ChannelInitializer myChannelInitializer;
|
||||
private final EventLoopGroup myEventLoopGroup;
|
||||
private volatile ChannelFuture myConnectFuture;
|
||||
private final ProtobufClientMessageHandler<T> myMessageHandler;
|
||||
|
||||
public SimpleProtobufClient(final MessageLite msgDefaultInstance, final Executor asyncExec, final UUIDGetter uuidGetter) {
|
||||
myMessageHandler = new ProtobufClientMessageHandler<>(uuidGetter, this, asyncExec);
|
||||
myEventLoopGroup = new NioEventLoopGroup(1, asyncExec);
|
||||
myChannelInitializer = new ChannelInitializer() {
|
||||
@Override
|
||||
protected void initChannel(Channel channel) {
|
||||
channel.pipeline().addLast(new ProtobufVarint32FrameDecoder(),
|
||||
new ProtobufDecoder(msgDefaultInstance),
|
||||
new ProtobufVarint32LengthFieldPrepender(),
|
||||
new ProtobufEncoder(),
|
||||
myMessageHandler);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void checkConnected() throws Exception {
|
||||
if (myState.get() != State.CONNECTED) {
|
||||
throw new Exception("Client not connected");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean connect(final String host, final int port) {
|
||||
if (myState.compareAndSet(State.DISCONNECTED, State.CONNECTING)) {
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
final Bootstrap bootstrap = new Bootstrap().group(myEventLoopGroup).channel(NioSocketChannel.class).handler(myChannelInitializer);
|
||||
bootstrap.option(ChannelOption.TCP_NODELAY, true).option(ChannelOption.SO_KEEPALIVE, true);
|
||||
final ChannelFuture future = bootstrap.connect(host, port).syncUninterruptibly();
|
||||
success = future.isSuccess();
|
||||
if (success) {
|
||||
myConnectFuture = future;
|
||||
try {
|
||||
onConnect();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
finally {
|
||||
myState.compareAndSet(State.CONNECTING, success? State.CONNECTED : State.DISCONNECTED);
|
||||
}
|
||||
}
|
||||
// already connected
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onConnect() {
|
||||
}
|
||||
private void beforeDisconnect() {
|
||||
}
|
||||
private void onDisconnect() {
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
if (myState.compareAndSet(State.CONNECTED, State.DISCONNECTING)) {
|
||||
try {
|
||||
final ChannelFuture future = myConnectFuture;
|
||||
if (future != null) {
|
||||
try {
|
||||
beforeDisconnect();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
final ChannelFuture closeFuture = future.channel().close();
|
||||
closeFuture.awaitUninterruptibly();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
myConnectFuture = null;
|
||||
myState.compareAndSet(State.DISCONNECTING, State.DISCONNECTED);
|
||||
try {
|
||||
onDisconnect();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return myState.get() == State.CONNECTED;
|
||||
}
|
||||
|
||||
public RequestFuture<T> sendMessage(final UUID messageId,
|
||||
MessageLite message,
|
||||
final @Nullable T responseHandler,
|
||||
final @Nullable RequestFuture.CancelAction<T> cancelAction) {
|
||||
final RequestFuture<T> requestFuture = new RequestFuture<>(responseHandler, messageId, cancelAction);
|
||||
myMessageHandler.registerFuture(messageId, requestFuture);
|
||||
final ChannelFuture connectFuture = myConnectFuture;
|
||||
final Channel channel = connectFuture != null? connectFuture.channel() : null;
|
||||
if (channel != null && channel.isActive()) {
|
||||
channel.writeAndFlush(message).addListener(new ChannelFutureListener() {
|
||||
@Override
|
||||
public void operationComplete(ChannelFuture future) {
|
||||
if (!future.isSuccess()) {
|
||||
notifyTerminated(messageId, requestFuture, responseHandler);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
notifyTerminated(messageId, requestFuture, responseHandler);
|
||||
}
|
||||
return requestFuture;
|
||||
}
|
||||
|
||||
private void notifyTerminated(UUID messageId, RequestFuture<T> requestFuture, @Nullable T responseHandler) {
|
||||
try {
|
||||
myMessageHandler.removeFuture(messageId);
|
||||
if (responseHandler != null) {
|
||||
responseHandler.sessionTerminated();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
requestFuture.setDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* 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 org.jetbrains.jps.client;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.javac.JavacRemoteProto;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public interface UUIDGetter {
|
||||
@NotNull UUID getSessionUUID(@NotNull JavacRemoteProto.Message message);
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.jps.api.CanceledStatus;
|
||||
import org.jetbrains.jps.builders.java.JavaCompilingTool;
|
||||
import org.jetbrains.jps.cmdline.ClasspathBootstrap;
|
||||
import org.jetbrains.jps.incremental.GlobalContextKey;
|
||||
import org.jetbrains.jps.javac.rpc.JavacRemoteProto;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
import java.io.File;
|
||||
|
||||
Reference in New Issue
Block a user