Giter Site home page Giter Site logo

Comments (3)

stephan-herrmann avatar stephan-herrmann commented on July 18, 2024

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.

stephan-herrmann avatar stephan-herrmann commented on July 18, 2024

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.

stephan-herrmann avatar stephan-herrmann commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.