Commit Graph

252 Commits

Author SHA1 Message Date
Lana Steuck
be00b8110f Merge 2013-07-17 10:40:53 -07:00
Maurizio Cimadamore
eb4e8153b3 8020147: Spurious errors when compiling nested stuck lambdas
Scope of deferred types is not copied correctly; postAttr analyzer should not run on stuck expressions

Reviewed-by: jjg
2013-07-17 14:13:15 +01:00
Maurizio Cimadamore
e92a56fade 8012238: Nested method capture and inference
8008200: java/lang/Class/asSubclass/BasicUnit.java fails to compile

Inference support should be more flexible w.r.t. nested method calls returning captured types

Reviewed-by: jjg, vromero
2013-07-17 14:11:41 +01:00
Maurizio Cimadamore
99b0413d48 8016175: Add bottom-up type-checking support for unambiguous method references
Type-checking of non-overloaded method references should be independent from target-type

Reviewed-by: jjg, vromero
2013-07-17 14:09:46 +01:00
Maurizio Cimadamore
941752ea25 8012242: Lambda compatibility and checked exceptions
Inference variables in 'throws' clause with no constraints should be inferred as RuntimeException

Reviewed-by: jjg, vromero
2013-07-17 14:04:01 +01:00
Maurizio Cimadamore
617386d568 8013404: Unclear spec for target typing with conditional operator (?:)
Fix previously ignored test

Reviewed-by: jjg, vromero
2013-07-11 15:37:02 +01:00
Robert Field
d3d1da337a 8016281: The SAM method should be passed to the metafactory as a MethodType not a MethodHandle
8020010: Move lambda bridge creation from metafactory and VM to compiler

Langtools/javac component of the bridge support and MethodType vs. MethodHandle changes.

Reviewed-by: jjg, vromero, briangoetz, forax
2013-07-11 14:07:39 +01:00
Maurizio Cimadamore
28b5759093 8016059: Cannot compile following lambda
8016060: Lambda isn't compiled with return statement

Spurious error triggered during unnecessary recovery round

Reviewed-by: jjg, vromero
2013-07-05 11:03:04 +01:00
Maurizio Cimadamore
86f630b63e 8019480: Javac crashes when method is called on a type-variable receiver from lambda expression
Logic for shortcircuiting speculative attribution doesn't handle type-variable receivers

Reviewed-by: jjg, vromero
2013-07-05 11:02:17 +01:00
Maurizio Cimadamore
7e6f7dcca5 8017618: NullPointerException in RichDiagnosticFormatter for bad input program
RDF crashes when diagnostic contains type 'void'

Reviewed-by: jjg, vromero
2013-07-05 11:00:19 +01:00
Eric McCorkle
9b1ec513d5 8013357: javac accepts erroneous binary comparison operations
Javac does not report type errors on illegal Object == primitive comparisons

Reviewed-by: abuckley, mcimadamore
2013-06-27 17:45:56 -04:00
Chris Hegarty
700804c6f2 8017045: anti-delta fix for 8013789
Reviewed-by: alanb
2013-06-19 11:48:05 +01:00
Maurizio Cimadamore
1839512a15 8013789: Compiler should emit bridges in interfaces
Paired with 8015402: Lambda metafactory should not attempt to determine bridge methods

Reviewed-by: vromero
2013-06-17 20:29:31 -07:00
Maurizio Cimadamore
80407ef47d 8013576: Add stat support to LambdaToMethod
LambdaToMethod should emit info to help diagnose/test lambda metafactory problems

Reviewed-by: jjg, vromero
2013-06-10 15:57:32 +01:00
Maurizio Cimadamore
459b2cba93 8015648: Duplicate variable in lambda causes javac crash
Missing flag in synthetic lambda blog is causing duplicates symbol to go undetected

Reviewed-by: jjg, vromero
2013-06-06 15:37:23 +01:00
Maurizio Cimadamore
abaf1a5c51 8015432: javac crashes with stack overflow when method called recursively from nested generic call
Check.checkMethod should only be called after inference has completed

Reviewed-by: jjg, vromero
2013-06-06 15:35:05 +01:00
Maurizio Cimadamore
07baf8072a 8008627: Compiler mishandles three-way return-type-substitutability
Compiler should not enforce an order in how ambiguous methods should be resolved

Reviewed-by: jjg, vromero
2013-06-06 15:33:40 +01:00
Maurizio Cimadamore
1c6a680e66 8008160: Five lambda TargetType tests have @ignore
Remove @ignore flags from tests that now pass

Reviewed-by: jjg
2013-06-04 11:31:12 +01:00
Maurizio Cimadamore
d176f2abdf 8014494: javac crashes when varargs element of a method reference is inferred from the context
Varargs element is not refreshed after type-inference

Reviewed-by: jjg, vromero
2013-05-24 15:27:27 +01:00
Vicente Romero
6a02cd46e0 8005207: test has 2 @bug tags
Reviewed-by: mcimadamore
2013-05-21 13:50:56 +01:00
Robert Field
495e78ce52 8010006: NPE in javac with interface super in lambda
Reviewed-by: mcimadamore
2013-05-15 06:53:01 -07:00
Maurizio Cimadamore
4b1aa379e5 8013222: Javac issues spurious raw type warnings when lambda has implicit parameter types
Bad warnings and position for lambda inferred parameter types

Reviewed-by: jjg, vromero
2013-05-15 14:03:09 +01:00
Maurizio Cimadamore
fc9e870275 8012685: Spurious raw types warning when using unbound method references
Spurious raw type warning when unbound method reference qualifier parameter types are inferred from target

Reviewed-by: jjg, vromero
2013-05-15 14:02:37 +01:00
Maurizio Cimadamore
ec458693f7 8012003: Method diagnostics resolution need to be simplified in some cases
Unfold method resolution diagnostics when they mention errors in poly expressions

Reviewed-by: jjg, vromero
2013-05-15 14:00:31 +01:00
Robert Field
c51505263f 8012556: Implement lambda methods on interfaces as static
8006140: Javac NPE compiling Lambda expression on initialization expression of static field in interface

Lambdas occurring in static contexts or those not needing instance information should be generated into static methods.  This has long been the case for classes.  However, as a work-around to the lack of support for statics on interfaces, interface lambda methods have been generated into default methods.  For lambdas in interface static contexts (fields and static methods) this causes an NPE in javac because there is no 'this'.  MethodHandles now support static methods on interfaces.  This changeset allows lambda methods to be generated as static interface methods.  An existing bug in Hotspot (8013875) is exposed in a test when the "-esa" flag is used.  This test and another test that already exposed this bug have been marked with @ignore.

Reviewed-by: mcimadamore
2013-05-14 11:11:09 -07:00
Robert Field
136b4bc9b2 8014023: When a method reference to a local class constructor is contained in a method whose number of parameters matches the number of constructor parameters compilation fails
Reviewed-by: mcimadamore
2013-05-07 06:39:34 -07:00
Jonathan Gibbons
155bd74411 8012728: Normalize @ignore comments on langtools tests
Reviewed-by: vromero, mcimadamore
2013-05-03 09:56:56 -07:00
Robert Field
0ab1bb68cc 8011591: BootstrapMethodError when capturing constructor ref to local classes
Reviewed-by: mcimadamore
2013-05-01 08:46:04 -07:00
Maurizio Cimadamore
8b680bdde2 8011392: Missing checkcast when casting to intersection type
Javac should emit a checkcast for each additional target type specified in an intersection type cast

Reviewed-by: jjg
2013-04-15 14:17:30 +01:00
Maurizio Cimadamore
8f2d47cf79 8011028: lang/INFR/infr001/infr00101md/infr00101md.java fails to compile after switch to JDK8-b82
Fix bug in Types.removeWildcards

Reviewed-by: jjg
2013-04-15 14:16:05 +01:00
Maurizio Cimadamore
e59fd44a73 8011376: Spurious checked exception errors in nested method call
Fallback attribution logic doesn't work properly when lambda throws checked exceptions

Reviewed-by: jjg
2013-04-15 14:15:07 +01:00
Maurizio Cimadamore
2b94dbb504 8011377: Javac crashes when multiple lambdas are defined in an array
Wrong attribution environment used by DeferredAttr

Reviewed-by: jjg
2013-04-15 14:12:17 +01:00
Maurizio Cimadamore
da9dd76b20 8010822: Intersection type cast for functional expressions does not follow spec EDR
Remove support for marker interfaces; redefine intersection type casts to be order-independent

Reviewed-by: jjg
2013-04-08 15:59:29 +01:00
Maurizio Cimadamore
ea55015155 8009131: Overload: javac should discard methods that lead to errors in lambdas with implicit parameter types
Lambdas that have errors in their bodies should make enclosing overload resolution fail

Reviewed-by: jjg
2013-04-08 15:57:10 +01:00
Maurizio Cimadamore
b4b6e4f82e 8010404: Lambda debugging: redundant LineNumberTable entry for lambda capture
Ignore indy entries in LineNumberTable

Reviewed-by: jjg
2013-04-08 15:53:08 +01:00
Maurizio Cimadamore
2b66afe14d 8010303: Graph inference: missing incorporation step causes spurious inference error
Multiple equality constraints on inference vars are not used to generate new inference constraints

Reviewed-by: jjg
2013-03-22 12:43:09 +00:00
Maurizio Cimadamore
710a687c15 8009820: AssertionError when compiling java code with two identical static imports
Speculative attribution is carried out twice with same method symbol in case of static imports

Reviewed-by: jjg
2013-03-22 12:41:13 +00:00
Maurizio Cimadamore
cec722fe8f 8010101: Intersection type cast issues redundant unchecked warning
Code for checking intersection type cast is incorrectly swapping operands, leading to spurious warnings

Reviewed-by: jjg
2013-03-22 12:39:34 +00:00
Maurizio Cimadamore
2454c8c5ae 8009649: Lambda back-end should generate invokespecial for method handles referring to private instance methods
Private lambda methods should be accessed through invokespecial

Reviewed-by: jjg
2013-03-22 12:38:12 +00:00
Robert Field
46e9ef69a7 8010010: NPE generating serializedLambdaName for nested lambda
Reviewed-by: mcimadamore
2013-03-14 22:54:17 -07:00
Maurizio Cimadamore
22e2c128a2 8009545: Graph inference: dependencies between inference variables should be set during incorporation
Move all transitivity checks into the incorporation round

Reviewed-by: jjg
2013-03-12 16:02:43 +00:00
Maurizio Cimadamore
69ee819808 8008540: Constructor reference to non-reifiable array should be rejected
8008539: Spurious error when constructor reference mention an interface type
8008538: Constructor reference accepts wildcard parameterized types

Overhaul of Check.checkConstructorRefType

Reviewed-by: jjg
2013-03-12 16:02:13 +00:00
Robert Field
41447ec765 8009742: Bad lambda name for lambda in a static initializer or ctor
Reviewed-by: mcimadamore
2013-03-11 10:02:55 -07:00
Robert Field
867e1720c2 8009582: Method reference generic constructor gives: IllegalArgumentException: Invalid lambda deserialization
Reviewed-by: mcimadamore
2013-03-07 08:26:13 -08:00
Maurizio Cimadamore
c9bae7b335 8009299: Javac crashes when compiling method reference to static interface method
Assertion in Check.checMethod is too strict

Reviewed-by: jjg
2013-03-06 15:29:30 +00:00
Maurizio Cimadamore
e788a0e536 8009129: Illegal access error when calling method reference
Javac generates method handle referencing non public type

Reviewed-by: jjg, rfield
2013-03-05 14:19:49 +00:00
Maurizio Cimadamore
7a28d6291d 8009154: Missing cast in method reference bridge leads to NoSuchMethodError
Missing cast in generated method reference bridge

Reviewed-by: rfield, jjg
2013-03-05 14:16:07 +00:00
Maurizio Cimadamore
3cbe22f256 8009227: Certain diagnostics should not be deferred
Add new diagnostic flag to mark non deferrable diagnostics

Reviewed-by: jjg
2013-03-05 14:12:07 +00:00
Maurizio Cimadamore
d0a0df54ed 8004962: Code generation crash with lambda and local classes
Translation info should be propagated from LambdaToMethod to Lower

Reviewed-by: jjg, rfield
2013-03-05 14:04:57 +00:00
Maurizio Cimadamore
f932d844c1 8008537: Missing method reference lookup error when unbound search finds a static method
Static-ness check should be applied after member reference resolution

Reviewed-by: jjg
2013-02-28 14:05:52 +00:00
Maurizio Cimadamore
85067f7869 8008813: Structural most specific fails when method reference is passed to overloaded method
Bad logic for checking most specific method reference type

Reviewed-by: jjg
2013-02-28 14:05:44 +00:00
Maurizio Cimadamore
9c01455eb6 8008723: Graph Inference: bad graph calculation leads to assertion error
Dependencies are not propagated correctly through merged nodes during inference graph initialization

Reviewed-by: jjg
2013-02-28 14:00:52 +00:00
Maurizio Cimadamore
7776fdebe7 8008708: Regression: separate compilation causes crash in wildcards inference logic
Invalid use of WildcardType.bound in Types.removeWildcards

Reviewed-by: jjg
2013-02-22 18:19:51 +00:00
Sonali Goel
96495bc664 8008337: Write test to check for compiler error when static method in interface is called via super()
Reviewed-by: mcimadamore
2013-02-22 13:31:35 +00:00
Robert Field
bcaa703a49 8008405: Now that metafactory is in place, add javac lambda serialization tests
Tests part of original langtools serialization review.

Reviewed-by: mcimadamore
2013-02-21 14:43:51 -08:00
Maurizio Cimadamore
73b1aee3f4 8008444: Inherited generic functional descriptors are merged incorrectly
Missing call to Types.createMethodWithThrownTypes

Reviewed-by: jjg
2013-02-21 15:27:05 +00:00
Maurizio Cimadamore
8c1621ee38 8008293: Declared bounds not considered when functional interface containing unbound wildcards is instantiated
Wildcards inference should re-use some of the bounds info generated during capture conversion

Reviewed-by: jjg
2013-02-21 15:25:03 +00:00
Maurizio Cimadamore
5bbf5f39fc 8005183: Missing accessor for constructor reference pointing to private inner class ctor
Compiler should add bridges when translating private constructor reference

Reviewed-by: jjg
2013-02-21 15:23:48 +00:00
Maurizio Cimadamore
937b7d2fba 8008276: assertion error in com.sun.tools.javac.comp.TransTypes.visitApply
DiagnosticFilter used during speculative attribution is too broad

Reviewed-by: jjg
2013-02-21 15:21:38 +00:00
Maurizio Cimadamore
eb68b33185 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
Disentangle cyclic dependency between static-ness of synthetic lambda method and static-ness of classes nested within lambdas

Reviewed-by: jjg
2013-02-21 15:19:29 +00:00
Robert Field
b2a3c762ff 8004969: Generate $deserializeLambda$ method
8006763: super in method reference used in anonymous class - ClassFormatError is produced
8005632: Inner classes within lambdas cause build failures
8005653: Lambdas containing inner classes referencing external type variables do not correctly parameterize the inner classes

Reviewed-by: mcimadamore
2013-02-15 18:40:38 -08:00
Maurizio Cimadamore
fd17a4290b 8008309: TargetType60 fails because of bad golden file
Bad golden file

Reviewed-by: jjg
2013-02-15 18:13:00 +00:00
Sonali Goel
30058417e1 8007427: Annotation element as '_' gives compiler error instead of a warning
8007401: Write test to check for generation of warnings when '_' is used as an identifier

Extended identifier production not used in annotation values

Reviewed-by: jjg
2013-02-15 16:31:19 +00:00
Maurizio Cimadamore
f5df2a2562 8007535: Compiler crashes on @FunctionalInterface used on interface with two inherited methods with same signatures
Bad check in Types.interfaceCandidates

Reviewed-by: jjg
2013-02-15 16:30:31 +00:00
Maurizio Cimadamore
b496912ee1 8007462: Fix provisional applicability for method references
Add speculative arity-based check to rule out potential candidates when stuck reference is passed to method

Reviewed-by: jjg
2013-02-15 16:29:58 +00:00
Maurizio Cimadamore
e88e06a5e0 8007285: AbstractMethodError instead of compile-time error when method reference with super and abstract
Missing abstractness check on super rmethod references

Reviewed-by: jjg
2013-02-15 16:28:57 +00:00
Maurizio Cimadamore
f8f9896cc7 8006749: compiler does not allow Object protected methods to be used in lambda
Check.checkFunctionalInterface should take into account 'fake' override

Reviewed-by: jjg
2013-02-15 16:28:07 +00:00
Maurizio Cimadamore
1ec5dfafe0 8007464: Add graph inference support
Add support for more aggressive type-inference scheme

Reviewed-by: jjg
2013-02-12 19:25:09 +00:00
Jim Holmlund
8985a7c2ac 8007504: Remove @ignore from tests that no longer need it
Reviewed-by: mcimadamore
2013-02-05 18:55:13 +00:00
Maurizio Cimadamore
5b1a78dc92 8006694: temporarily workaround combo tests are causing time out in several platforms
Reviewed-by: jjg
2013-01-23 20:57:40 +00:00
Maurizio Cimadamore
1f8b2abf80 8006684: Compiler produces java.lang.VerifyError: Bad type on operand stack
Lambda desugaring generates spurious references to 'this' in static contexts

Reviewed-by: jjg
2013-01-22 16:39:51 +00:00
Maurizio Cimadamore
948888218b 8006673: TargetType52 fails because of bad golden file
Fix golden file in negative test

Reviewed-by: jjg
2013-01-22 16:23:35 +00:00
Maurizio Cimadamore
422c8bd914 8006566: Remove transient lambda-related guards from JavacParser
Remove transitional internal flag for allowing intersection types in cast

Reviewed-by: jjg
2013-01-21 20:14:39 +00:00
Maurizio Cimadamore
442154dcf9 8005244: Implement overload resolution as per latest spec EDR
Add support for stuck expressions and provisional applicability

Reviewed-by: jjg
2013-01-21 20:13:56 +00:00
Maurizio Cimadamore
00ae27b2cf 8006561: Langtools test failure: missing diags/examples
Forgot to hg add tests

Reviewed-by: jjg
2013-01-18 15:38:14 +00:00
Maurizio Cimadamore
0a95b1d28c 8005852: Treatment of '_' as identifier
Warn when '_' is found in an identifier position

Reviewed-by: jjg
2013-01-17 18:15:20 +00:00
Maurizio Cimadamore
3b3feb3853 8005299: Add FunctionalInterface checking to javac
Javac should check that types annotated with @FunctionalInterface are indeed functional interfaces

Reviewed-by: jjg
2013-01-16 16:30:11 +00:00
Maurizio Cimadamore
d19bc80ca1 8005854: Add support for array constructor references
Support constructor references of the kind int[]::new

Reviewed-by: jjg
2013-01-16 16:27:01 +00:00
Vicente Romero
9d4f6a0ebe 8005167: execution time of combo tests in javac should be improved
Reviewed-by: jjg, jjh
2013-01-08 13:47:57 +00:00
Maurizio Cimadamore
c932023b04 8005179: Cleanup Resolve.AmbiguityError
Linearize nested ambiguity errors

Reviewed-by: jjg
2013-01-08 10:16:26 +01:00
Lana Steuck
f2c7a7867a Merge 2012-12-28 18:39:09 -08:00
David Katleman
8208c844dd 8004982: JDK8 source with GPL header errors
Reviewed-by: ohair
2012-12-20 16:24:18 -08:00
Maurizio Cimadamore
2296453268 8005193: New regression test test/tools/javac/lambda/BadMethodCall2.java fails
Bad golden file in negative test

Reviewed-by: jjh
2012-12-18 22:16:45 +00:00
Maurizio Cimadamore
08823b6103 8004099: Bad compiler diagnostic generated when poly expression is passed to non-existent method
Some code paths in resolve do not use methodArguments to correctly format actuals

Reviewed-by: jjg
2012-12-17 16:13:01 +00:00
Vicente Romero
c1804d6409 8000518: Javac generates duplicate name_and_type constant pool entry for class BinaryOpValueExp.java
Reviewed-by: jjg, mcimadamore
2012-12-15 13:54:51 +00:00
Maurizio Cimadamore
d7884e5ae2 8002099: Add support for intersection types in cast expression
Add parser and type-checking support for intersection types in cast expressions

Reviewed-by: jjg
2012-11-30 15:14:48 +00:00
Maurizio Cimadamore
c76c08e82a 8004101: Add checks for method reference well-formedness
Bring method reference type-checking in sync with latest EDR

Reviewed-by: jjg
2012-11-30 15:14:36 +00:00
Maurizio Cimadamore
0db60b7bb2 8004102: Add support for generic functional descriptors
Method references are allowed to have a generic functional interface descriptor target

Reviewed-by: jjg
2012-11-30 15:14:25 +00:00
Maurizio Cimadamore
684271da34 8004105: Expression statement lambdas should be void-compatible
Fix lambda compatibility rules as per latest EDR

Reviewed-by: jjg
2012-11-30 15:14:12 +00:00
Robert Field
d1a78e2021 8003639: convert lambda testng tests to jtreg and add them
Reviewed-by: mcimadamore
2012-11-20 09:58:55 -08:00
Maurizio Cimadamore
d1eede168b 8003663: lambda test fails on Windows
Fix path separator issue in test

Reviewed-by: jjg
2012-11-20 15:43:28 +00:00
Maurizio Cimadamore
a494f0ab86 8003280: Add lambda tests
Turn on lambda expression, method reference and default method support

Reviewed-by: jjg
2012-11-17 19:01:03 +00:00
Robert Field
be815ba8fa 8003306: Compiler crash: calculation of inner class access modifier
Fix binary sense lost in transition to hasTag

Reviewed-by: mcimadamore
2012-11-13 08:06:00 -08:00
Maurizio Cimadamore
319150fde0 7177386: Add attribution support for method references
Add type-checking/lookup routines for method references

Reviewed-by: jjg, dlsmith
2012-10-06 10:35:38 +01:00
Maurizio Cimadamore
8fbd614bf3 8000241: langtools doesn't build
Bad merge with langtools tip caused build glitch

Reviewed-by: jjg
2012-09-28 18:50:40 +01:00
Maurizio Cimadamore
07155682a1 7194586: Add back-end support for invokedynamic
Add support for invokedynamic bytecode instruction; includes suppot for generation of all related classfile attributes

Reviewed-by: jjg
2012-09-25 11:53:18 +01:00
Maurizio Cimadamore
a39622326e 7175538: Integrate efectively final check with DA/DU analysis
Allow generalized effectively-final analysis for all local variables

Reviewed-by: jjg, dlsmith
2012-08-02 18:23:21 +01:00
Jonathan Gibbons
42b9d6bc2e 7124605: typos in javac comments
Reviewed-by: ksrini
2011-12-23 22:30:33 +00:00
Maurizio Cimadamore
61ee75c9d4 7120463: Fix method reference parser support in order to avoid ambiguities
Add lookahead routine to disambiguate between method reference in method context and binary expression

Reviewed-by: jjg, dlsmith
2011-12-19 12:07:07 +00:00
Maurizio Cimadamore
bf0106a903 7120266: javac fails to compile hotspot code
Parser changes for method references cause bad intercation with method call syntax

Reviewed-by: jjg
2011-12-11 17:48:25 +00:00
Maurizio Cimadamore
b0a9998899 7115052: Add parser support for method references
Add support for parsing method references to JavacParser

Reviewed-by: jjg
2011-11-28 16:05:46 +00:00
Maurizio Cimadamore
4ac518143c 7115050: Add parser support for lambda expressions
Add support for parsing lambda expressions to JavacParser

Reviewed-by: jjg
2011-11-28 15:56:42 +00:00