Comments (3)
To recap the role of exception constraints during inference, here's as central statement from 18.2.1:
We do not attempt to produce bounds on inference variables that appear in the target function type's throws clause. This is because exception containment is not part of compatibility (§15.27.3) - in particular, it must not influence method applicability (§18.5.1). However, we do get bounds on these variables later, because invocation type inference (§18.5.2.2) produces exception containment constraint formulas (§18.2.5).
This helps to explain, why in the above example leaving getEx()
under specified results in method ambiguity, even when we remove throw new IllegalAccessException();
from the lambda body. Knowing that only IOException
can be thrown doesn't help selecting one of the overloads based on inferring X
. This inference happens only after applicability inference.
For the same reason, availability of test()
will only be determined after inference, because it needs the result of invocation type inference.
from eclipse.jdt.core.
This item from 18.2.5. is incompletely implemented in ecj:
If n = 0 (the function type's throws clause consists only of proper types), then if there exists some i (1 ≤ i ≤ m) such that Xi is not a subtype of any proper type in the throws clause, the constraint reduces to false; otherwise, the constraint reduces to true.
We don't have that 'false' case.
from eclipse.jdt.core.
In 18.2.5. E'
(JLS 8) has been renamed to X
(JLS 22) but other than that plus the omission mentioned above, our implementation of exception inference is well-aligned with the spec, still.
from eclipse.jdt.core.
Related Issues (20)
- [22] Merge BETA_JAVA22 to master HOT 2
- java.lang.StackOverflowError on autocomplete imports on JDK 11+ projects HOT 3
- Type content assist fails to add disambiguating import
- RFE: issue (optional) warning when '==' is used on wrapper types HOT 4
- ASTNode->IVariableBinding->IJavaElement fails when dereferencing enum component in compact constructor
- false positive contradictory null annotations since 2024-03 HOT 1
- ASTParser doesn't parse task tags HOT 2
- Request for a new method in IVariableBinding to retrieve the original binding of a variable captured by a Lambda
- ASTConverterSuperAfterStatements.test004 fails on master HOT 13
- [Enhanced switch] Case null disallowed when switching on arrays HOT 1
- Eclipse 2024-03 reports unclosed closeable for whitelisted StreamEx HOT 3
- [Java 22] HierarchicalASTVisitor must be updated to reflect a change in the ASTNode hierarchy HOT 1
- rephrase compiler messages: move most significant info to the beginning
- Extract method in switch expression with yield keep yield in extracted method
- Calling `JavaProject.setModuleDescription()` should invalidate the resolved classpath HOT 1
- [22] Byte code backward compatibility for compilation targets < 22 violated with '-proceedOnError', because parser falsely identifies unnamed class HOT 3
- Minor: Extract method from method in nested static class to outer class looses class variable
- Resorce Leak compiler error/warning (detection) has some problem HOT 13
- Could LambdaExpression.analyseExceptions() cause problematic side-effects? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eclipse.jdt.core.