Java lambdas (JSR 335): Why “eliminate support for unbound inner class constructor references”?2019 Community Moderator ElectionJava 8 lambda predicate chaining?Java inner class and static nested classHow are Anonymous (inner) classes used in Java?Why doesn't Java support unsigned ints?Java: Static vs inner classWhy is Java Vector (and Stack) class considered obsolete or deprecated?Why can outer Java classes access inner class private members?Why don't Java Generics support primitive types?Why are you not able to declare a class as static in Java?has JSR-335 special support in JVM? Boost for functional JVM-based languages?Is there any difference between Objects::nonNull and x -> x != null?
Combining an idiom with a metonymy
How to deal with a cynical class?
Most cost effective thermostat setting: consistent temperature vs. lowest temperature possible
Why do passenger jet manufacturers design their planes with stall prevention systems?
Gantt Chart like rectangles with log scale
Have researchers managed to "reverse time"? If so, what does that mean for physics?
how to write formula in word in latex
How difficult is it to simply disable/disengage the MCAS on Boeing 737 Max 8 & 9 Aircraft?
How can I track script which gives me "command not found" right after the login?
SOQL: Populate a Literal List in WHERE IN Clause
How to terminate ping <dest> &
How to change two letters closest to a string and one letter immediately after a string using notepad++
A Cautionary Suggestion
Dice rolling probability game
How to explain that I do not want to visit a country due to personal safety concern?
What's the meaning of “spike” in the context of “adrenaline spike”?
Sailing the cryptic seas
Brexit - No Deal Rejection
Official degrees of earth’s rotation per day
Do I need to be arrogant to get ahead?
Why would a flight no longer considered airworthy be redirected like this?
My Graph Theory Students
Welcoming 2019 Pi day: How to draw the letter π?
Could the Saturn V actually have launched astronauts around Venus?
Java lambdas (JSR 335): Why “eliminate support for unbound inner class constructor references”?
2019 Community Moderator ElectionJava 8 lambda predicate chaining?Java inner class and static nested classHow are Anonymous (inner) classes used in Java?Why doesn't Java support unsigned ints?Java: Static vs inner classWhy is Java Vector (and Stack) class considered obsolete or deprecated?Why can outer Java classes access inner class private members?Why don't Java Generics support primitive types?Why are you not able to declare a class as static in Java?has JSR-335 special support in JVM? Boost for functional JVM-based languages?Is there any difference between Objects::nonNull and x -> x != null?
In the current JSR 335 draft, it's mentioned in the change log entry for 0.6.0 that it "eliminated support for unbound inner class constructor references".
To illustrate, suppose you have an outer class named A
and an inner class named B
, and you want a function that takes an A
and creates a new B
instance:
Function<A, A.B> foo = a -> a.new B();
Prior to 0.6.0, you can also use the constructor reference syntax to do the same thing (it's even documented in State of the Lambda):
Function<A, A.B> foo = A.B::new;
As mentioned above, that syntax is no longer supported in 0.6.0. I'm really curious to know why.
I've looked through the archives for the lambda-spec-experts
and lambda-dev
mailing lists, and cannot find any information about it.
java jsr335
add a comment |
In the current JSR 335 draft, it's mentioned in the change log entry for 0.6.0 that it "eliminated support for unbound inner class constructor references".
To illustrate, suppose you have an outer class named A
and an inner class named B
, and you want a function that takes an A
and creates a new B
instance:
Function<A, A.B> foo = a -> a.new B();
Prior to 0.6.0, you can also use the constructor reference syntax to do the same thing (it's even documented in State of the Lambda):
Function<A, A.B> foo = A.B::new;
As mentioned above, that syntax is no longer supported in 0.6.0. I'm really curious to know why.
I've looked through the archives for the lambda-spec-experts
and lambda-dev
mailing lists, and cannot find any information about it.
java jsr335
Do you really want to do that? Do you think it is obvious to even experienced Java programmers what is going on from that line alone?
– Tom Hawtin - tackline
Jun 20 '13 at 1:11
3
On the JVM level, inner class constructors are just constructors that additionally take a reference to the outer class. So the mental model is not surprising to me, at least. Granted, I'm not particularly trying to defend its use in a constructor reference expression, just trying to understand the rationale for its removal.
– Chris Jester-Young
Jun 20 '13 at 1:13
add a comment |
In the current JSR 335 draft, it's mentioned in the change log entry for 0.6.0 that it "eliminated support for unbound inner class constructor references".
To illustrate, suppose you have an outer class named A
and an inner class named B
, and you want a function that takes an A
and creates a new B
instance:
Function<A, A.B> foo = a -> a.new B();
Prior to 0.6.0, you can also use the constructor reference syntax to do the same thing (it's even documented in State of the Lambda):
Function<A, A.B> foo = A.B::new;
As mentioned above, that syntax is no longer supported in 0.6.0. I'm really curious to know why.
I've looked through the archives for the lambda-spec-experts
and lambda-dev
mailing lists, and cannot find any information about it.
java jsr335
In the current JSR 335 draft, it's mentioned in the change log entry for 0.6.0 that it "eliminated support for unbound inner class constructor references".
To illustrate, suppose you have an outer class named A
and an inner class named B
, and you want a function that takes an A
and creates a new B
instance:
Function<A, A.B> foo = a -> a.new B();
Prior to 0.6.0, you can also use the constructor reference syntax to do the same thing (it's even documented in State of the Lambda):
Function<A, A.B> foo = A.B::new;
As mentioned above, that syntax is no longer supported in 0.6.0. I'm really curious to know why.
I've looked through the archives for the lambda-spec-experts
and lambda-dev
mailing lists, and cannot find any information about it.
java jsr335
java jsr335
edited Sep 23 '13 at 18:53
Chris Jester-Young
asked Jun 20 '13 at 1:08
Chris Jester-YoungChris Jester-Young
184k39342399
184k39342399
Do you really want to do that? Do you think it is obvious to even experienced Java programmers what is going on from that line alone?
– Tom Hawtin - tackline
Jun 20 '13 at 1:11
3
On the JVM level, inner class constructors are just constructors that additionally take a reference to the outer class. So the mental model is not surprising to me, at least. Granted, I'm not particularly trying to defend its use in a constructor reference expression, just trying to understand the rationale for its removal.
– Chris Jester-Young
Jun 20 '13 at 1:13
add a comment |
Do you really want to do that? Do you think it is obvious to even experienced Java programmers what is going on from that line alone?
– Tom Hawtin - tackline
Jun 20 '13 at 1:11
3
On the JVM level, inner class constructors are just constructors that additionally take a reference to the outer class. So the mental model is not surprising to me, at least. Granted, I'm not particularly trying to defend its use in a constructor reference expression, just trying to understand the rationale for its removal.
– Chris Jester-Young
Jun 20 '13 at 1:13
Do you really want to do that? Do you think it is obvious to even experienced Java programmers what is going on from that line alone?
– Tom Hawtin - tackline
Jun 20 '13 at 1:11
Do you really want to do that? Do you think it is obvious to even experienced Java programmers what is going on from that line alone?
– Tom Hawtin - tackline
Jun 20 '13 at 1:11
3
3
On the JVM level, inner class constructors are just constructors that additionally take a reference to the outer class. So the mental model is not surprising to me, at least. Granted, I'm not particularly trying to defend its use in a constructor reference expression, just trying to understand the rationale for its removal.
– Chris Jester-Young
Jun 20 '13 at 1:13
On the JVM level, inner class constructors are just constructors that additionally take a reference to the outer class. So the mental model is not surprising to me, at least. Granted, I'm not particularly trying to defend its use in a constructor reference expression, just trying to understand the rationale for its removal.
– Chris Jester-Young
Jun 20 '13 at 1:13
add a comment |
1 Answer
1
active
oldest
votes
It's evident that the 'new' is a keyword, not a method, and that all involvment of 'new' as a method are special cases in the compiler. I can easily imagine they wanted to clean up the compiler of least likely usages which have trivial workarounds.
Speculation: there maybe also some collisions/ambiguities to resolve with upcoming JLS we don't know about yet, and this is a transition change to minimize regressions. 5-6 years after your question, do you suffer at all from this change? LOL
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f17203781%2fjava-lambdas-jsr-335-why-eliminate-support-for-unbound-inner-class-construct%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's evident that the 'new' is a keyword, not a method, and that all involvment of 'new' as a method are special cases in the compiler. I can easily imagine they wanted to clean up the compiler of least likely usages which have trivial workarounds.
Speculation: there maybe also some collisions/ambiguities to resolve with upcoming JLS we don't know about yet, and this is a transition change to minimize regressions. 5-6 years after your question, do you suffer at all from this change? LOL
add a comment |
It's evident that the 'new' is a keyword, not a method, and that all involvment of 'new' as a method are special cases in the compiler. I can easily imagine they wanted to clean up the compiler of least likely usages which have trivial workarounds.
Speculation: there maybe also some collisions/ambiguities to resolve with upcoming JLS we don't know about yet, and this is a transition change to minimize regressions. 5-6 years after your question, do you suffer at all from this change? LOL
add a comment |
It's evident that the 'new' is a keyword, not a method, and that all involvment of 'new' as a method are special cases in the compiler. I can easily imagine they wanted to clean up the compiler of least likely usages which have trivial workarounds.
Speculation: there maybe also some collisions/ambiguities to resolve with upcoming JLS we don't know about yet, and this is a transition change to minimize regressions. 5-6 years after your question, do you suffer at all from this change? LOL
It's evident that the 'new' is a keyword, not a method, and that all involvment of 'new' as a method are special cases in the compiler. I can easily imagine they wanted to clean up the compiler of least likely usages which have trivial workarounds.
Speculation: there maybe also some collisions/ambiguities to resolve with upcoming JLS we don't know about yet, and this is a transition change to minimize regressions. 5-6 years after your question, do you suffer at all from this change? LOL
answered Mar 7 at 14:18
user2023577user2023577
9631617
9631617
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f17203781%2fjava-lambdas-jsr-335-why-eliminate-support-for-unbound-inner-class-construct%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you really want to do that? Do you think it is obvious to even experienced Java programmers what is going on from that line alone?
– Tom Hawtin - tackline
Jun 20 '13 at 1:11
3
On the JVM level, inner class constructors are just constructors that additionally take a reference to the outer class. So the mental model is not surprising to me, at least. Granted, I'm not particularly trying to defend its use in a constructor reference expression, just trying to understand the rationale for its removal.
– Chris Jester-Young
Jun 20 '13 at 1:13