A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/google/google-java-format/commit/96f114c37c02fcfdfa0d4bc25b6e122d11afc485 below:

Prepare for an incompatible change to Log diagnostic handlers · google/google-java-format@96f114c · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+25

-1

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+25

-1

lines changed Original file line number Diff line number Diff line change

@@ -42,6 +42,7 @@

42 42

import com.sun.tools.javac.util.Log.DeferredDiagnosticHandler;

43 43

import com.sun.tools.javac.util.Options;

44 44

import java.io.IOException;

45 +

import java.lang.reflect.Constructor;

45 46

import java.lang.reflect.Method;

46 47

import java.net.URI;

47 48

import java.util.ArrayList;

@@ -365,7 +366,7 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept

365 366

return text;

366 367

}

367 368

});

368 -

DeferredDiagnosticHandler diagnostics = new DeferredDiagnosticHandler(log);

369 +

DeferredDiagnosticHandler diagnostics = deferredDiagnosticHandler(log);

369 370

ImmutableList<RawTok> rawToks = JavacTokens.getTokens(text, context, stopTokens);

370 371

Collection<JCDiagnostic> ds;

371 372

try {

@@ -482,6 +483,29 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept

482 483

return ImmutableList.copyOf(toks);

483 484

}

484 485 486 +

private static final Constructor<DeferredDiagnosticHandler>

487 +

DEFERRED_DIAGNOSTIC_HANDLER_CONSTRUCTOR = getDeferredDiagnosticHandlerConstructor();

488 + 489 +

// Depending on the JDK version, we might have a static class whose constructor has an explicit

490 +

// Log parameter, or an inner class whose constructor has an *implicit* Log parameter. They are

491 +

// different at the source level, but look the same to reflection.

492 + 493 +

private static Constructor<DeferredDiagnosticHandler> getDeferredDiagnosticHandlerConstructor() {

494 +

try {

495 +

return DeferredDiagnosticHandler.class.getConstructor(Log.class);

496 +

} catch (NoSuchMethodException e) {

497 +

throw new LinkageError(e.getMessage(), e);

498 +

}

499 +

}

500 + 501 +

private static DeferredDiagnosticHandler deferredDiagnosticHandler(Log log) {

502 +

try {

503 +

return DEFERRED_DIAGNOSTIC_HANDLER_CONSTRUCTOR.newInstance(log);

504 +

} catch (ReflectiveOperationException e) {

505 +

throw new LinkageError(e.getMessage(), e);

506 +

}

507 +

}

508 + 485 509

private static final Method GET_DIAGNOSTICS = getGetDiagnostics();

486 510 487 511

private static @Nullable Method getGetDiagnostics() {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4