8275233: Incorrect line number reported in exception stack trace thrown from a lambda expression
Reviewed-by: jlahoda
This commit is contained in:
parent
3955b037da
commit
d7c283a081
src/jdk.compiler/share/classes/com/sun/tools/javac/comp
test/langtools/tools/javac
diags/examples
lambda/deduplication
@ -165,9 +165,14 @@ public class LambdaToMethod extends TreeTranslator {
|
||||
dumpLambdaToMethodStats = options.isSet("debug.dumpLambdaToMethodStats");
|
||||
attr = Attr.instance(context);
|
||||
forceSerializable = options.isSet("forceSerializable");
|
||||
debugLinesOrVars = options.isSet(Option.G)
|
||||
|| options.isSet(Option.G_CUSTOM, "lines")
|
||||
|| options.isSet(Option.G_CUSTOM, "vars");
|
||||
boolean lineDebugInfo =
|
||||
options.isUnset(Option.G_CUSTOM) ||
|
||||
options.isSet(Option.G_CUSTOM, "lines");
|
||||
boolean varDebugInfo =
|
||||
options.isUnset(Option.G_CUSTOM)
|
||||
? options.isSet(Option.G)
|
||||
: options.isSet(Option.G_CUSTOM, "vars");
|
||||
debugLinesOrVars = lineDebugInfo || varDebugInfo;
|
||||
verboseDeduplication = options.isSet("debug.dumpLambdaToMethodDeduplication");
|
||||
deduplicateLambdas = options.getBoolean("deduplicateLambdas", true);
|
||||
nestmateLambdas = Target.instance(context).runtimeUseNestAccess();
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
// key: compiler.note.verbose.l2m.deduplicate
|
||||
// options: --debug=dumpLambdaToMethodDeduplication
|
||||
// options: -g:none --debug=dumpLambdaToMethodDeduplication
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Google LLC. 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test 8275233
|
||||
* @summary Incorrect line number reported in exception stack trace thrown from a lambda expression
|
||||
* @compile/ref=DeduplicationDebugInfo.out -XDrawDiagnostics -XDdebug.dumpLambdaToMethodDeduplication -g:none DeduplicationDebugInfo.java
|
||||
* @compile/ref=DeduplicationDebugInfo_none.out -XDrawDiagnostics -XDdebug.dumpLambdaToMethodDeduplication DeduplicationDebugInfo.java
|
||||
* @compile/ref=DeduplicationDebugInfo_none.out -XDrawDiagnostics -XDdebug.dumpLambdaToMethodDeduplication -g:lines DeduplicationDebugInfo.java
|
||||
* @compile/ref=DeduplicationDebugInfo_none.out -XDrawDiagnostics -XDdebug.dumpLambdaToMethodDeduplication -g:vars DeduplicationDebugInfo.java
|
||||
* @compile/ref=DeduplicationDebugInfo_none.out -XDrawDiagnostics -XDdebug.dumpLambdaToMethodDeduplication -g:lines,vars DeduplicationDebugInfo.java
|
||||
*/
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
class DeduplicationDebugInfoTest {
|
||||
void f() {
|
||||
Function<Object, Integer> f = x -> x.hashCode();
|
||||
Function<Object, Integer> g = x -> x.hashCode();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
DeduplicationDebugInfo.java:39:39: compiler.note.verbose.l2m.deduplicate: lambda$f$0(java.lang.Object)
|
@ -93,6 +93,7 @@ public class DeduplicationTest {
|
||||
Arrays.asList(
|
||||
"-d",
|
||||
".",
|
||||
"-g:none",
|
||||
"-XDdebug.dumpLambdaToMethodDeduplication",
|
||||
"-XDdebug.dumpLambdaToMethodStats"),
|
||||
null,
|
||||
|
Loading…
x
Reference in New Issue
Block a user