mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-22 19:37:49 +00:00
8353757: Log class should have a proper clear() method
Reviewed-by: vromero, mcimadamore
This commit is contained in:
parent
24ff96afe4
commit
5b42c46b48
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -267,7 +267,7 @@ public class JavacTaskPool {
|
||||
|
||||
if (ht.get(Log.logKey) instanceof ReusableLog) {
|
||||
//log already inited - not first round
|
||||
((ReusableLog)Log.instance(this)).clear();
|
||||
Log.instance(this).clear();
|
||||
Enter.instance(this).newRound();
|
||||
((ReusableJavaCompiler)ReusableJavaCompiler.instance(this)).clear();
|
||||
Types.instance(this).newRound();
|
||||
@ -395,11 +395,9 @@ public class JavacTaskPool {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
recorded.clear();
|
||||
sourceMap.clear();
|
||||
nerrors = 0;
|
||||
nwarnings = 0;
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
//Set a fake listener that will lazily lookup the context for the 'real' listener. Since
|
||||
//this field is never updated when a new task is created, we cannot simply reset the field
|
||||
//or keep old value. This is a hack to workaround the limitations in the current infrastructure.
|
||||
|
||||
@ -689,6 +689,20 @@ public class Log extends AbstractLog {
|
||||
diagnosticHandler.report(diagnostic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the state of this instance.
|
||||
*/
|
||||
public void clear() {
|
||||
recorded.clear();
|
||||
sourceMap.clear();
|
||||
nerrors = 0;
|
||||
nwarnings = 0;
|
||||
nsuppressederrors = 0;
|
||||
nsuppressedwarns = 0;
|
||||
while (diagnosticHandler.prev != null)
|
||||
popDiagnosticHandler(diagnosticHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Common diagnostic handling.
|
||||
* The diagnostic is counted, and depending on the options and how many diagnostics have been
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user