Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Roger Howell
@MysterAitch

re: #1962 / #2585 -- the fix supplied by marrtenc looks good, but the naming of the method threw me a little... I know the test case as an anonymous class declaration, but jp treats it as an ObjectCreationExpr... Is this an appropriate name for this?

I'm just trying to get my head around whether the root cause is jp not treating anyonymous inner classes as a classorinterfacedeclaration, but i'm feeling a little fuzzy on terminology at the moment!

e.g. should the new ActionListener() { ... } be detected as a class declaration? In some respects it is a mixture of a declaration and an initialisation.. But then again it's also an expression, and not necessarily mutually exclusive....
button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        ...
    }
}
Roger Howell
@MysterAitch
I'm currently hunting through the jls / docs to try and get a better idea in my own head, but figured I'd also ask here in case anyone is more familiar / has a better idea :)
Roger Howell
@MysterAitch

To answer my own question, it seems that "Anonymous Class Declarations" (jls 15.9.5) are included as a sub-section of "15.9 Class Instance Creation Expressions" section, suggesting that ObjectCreationExpr is fine! (albeit with slightly different terminology)

UnqualifiedClassInstanceCreationExpression:
new [TypeArguments] ClassOrInterfaceTypeToInstantiate ( [ArgumentList] ) [ClassBody]

https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.9

Danny van Bruggen
@matozoid
The nice thing about maintaining this project is learning these kinds of things :-)
I advise tagging next release only right at the moment you merge. That is when you are certain it will be in... the next release :-)
Roger Howell
@MysterAitch
Would you mind expanding on that a little? I can see some pros to adding milestones to only document "what has happened", but wondering if there are any "cons" that "labelling what is planned to happen in the future" might have, that I've missed
ZilinXiang
@ZilinXiang
Hey, there. I meet an error 'enum' cannot be used as an identifier as it is a keyword. when I tried to parse Enumeration enum = markers.elements();. I found an issue about the error, but I still have no idea to solve the problem.
Any help can be great.
Roger Howell
@MysterAitch
Hi @ZilinXiang , in the same way that you cannot have a variable that matches any of the java-specific special "keywords" (such as final or public or class), it is not permitted to have a variable called enum in Java.
If the code you're trying to parse isn't valid Java code (i.e. it can't be run in normal java) then there's a reasonable chance that javaparser won't process it either.
ZilinXiang
@ZilinXiang
I know that. The code belongs to an old project, it seems that it can be compiled in lower Java .
Roger Howell
@MysterAitch
Apologies, we have a full range of experienced / novice programmers ask questions and it's not always easy to see where somebody is along that spectrum!
The parser configuration can be configured to use a lower version of java (it defaults at java 8)
I think enums came in java 5, so setting it to java 4 could be a good place to start.
ZilinXiang
@ZilinXiang
Thanks a lot!
Roger Howell
@MysterAitch

Happy to help!

Just to add a disclaimer: I can't promise to be as quick at any other time - I just now happen to login and see you post! ;)

ZilinXiang
@ZilinXiang
@MysterAitch Another error..... Generics are not supported. when I parser coordinator.nrMatchers += requiredNrMatchers;. is it also related to the version of java?
Roger Howell
@MysterAitch
@ZilinXiang - Possibly. Google suggests they were introduced in java 5 (which would be incompatible/unsupported in the java 4 suggestion above). Try it and see!
ZilinXiang
@ZilinXiang
Okay, I'll try it. Thanks, I think I am lucky to get timely help, haha
Danny van Bruggen
@matozoid
@MysterAitch The idea is: if something goes to master, it will be in the next release. Then label it next release, and when doing the release you can change the label to the version number you're making. Instant changelog, fool proof :-) You're doing another process: you tag everything you want in the next release "next release" and then... dunno? You're going to check everything and merge it then? Maybe you need another label saying "ready for merge?" What I used to do was go through the open PR's before I started releasing, and check if they "felt" ready. No open discussion, everything green, positive vibe, etc. Then merge it or remind people the PR is missing the release. Oh yeah, another advantage of weekly releases: nobody gets impatient :-)
Danny van Bruggen
@matozoid
BTW: when is the next release coming? If you get the bintray push working I can get out of the loop :-)
Roger Howell
@MysterAitch
Not explicitly chatted with @edefazio yet about the next release, but I can give it a go later this evening and then next week @edefazio do it?
Danny van Bruggen
@matozoid
Cool!
Roger Howell
@MysterAitch
Is anything needed re: sonatype? I think you mentioned last time about an option in bintray pushing to maven central, and potentially needing credentials to do so?
edefazio
@edefazio
@MysterAitch you have my info... I should be available next week unless something come up
Roger Howell
@MysterAitch
(just looked -- yeah, it needs a user token key and token password.. pretty sure I have a sonatype user account, but not sure if it has the relevant permissions... That's something I can take a look at later tonight though, and then tomorrow / whenever you can follow up if needed )
@edefazio cool! if you'd rather take this week, then that's absolutely fine with me too :)
edefazio
@edefazio
next week better 4 me
Danny van Bruggen
@matozoid
I completely forgot how to set up the correct rights, but let's start with creating accounts for you both: https://issues.sonatype.org/secure/Signup!default.jspa
I guess you then need to open a ticket like this: https://issues.sonatype.org/browse/OSSRH-56435?filter=-4
Roger Howell
@MysterAitch
@edefazio sure thing!
Danny van Bruggen
@matozoid
Looks like I can open an issues like that, hmmm... Get me your usernames first.
Roger Howell
@MysterAitch
@matozoid I already have accounts there -- the bit I was more unclear about is whether the tickets are only for the initial registration of the coordinates, versus adding contributors
(username is MysterAitch btw )
Danny van Bruggen
@matozoid
What I understand is that you have to register a domain name (here it is org.javaparser, for myself it's com.laamella) and then give users rights to do stuff there, so I'll add you people to org.javaparser :-)
edefazio
@edefazio
username : edefazio
Danny van Bruggen
@matozoid
Okay, let me see...
Danny van Bruggen
@matozoid
Well, let's hope I did that right: https://issues.sonatype.org/browse/OSSRH-56438
Jira always makes me nervous with its huge amount of fields that need to be filled out with who knows what.
Roger Howell
@MysterAitch
is "exiting" intentional (e.g. versus "existing"?)
haha 100% agreed re: jira!!
edefazio
@edefazio
I concur
Danny van Bruggen
@matozoid
Yep, I'm exiting :-)
Roger Howell
@MysterAitch
also, is it definitely org.javaparser ? note the current pom has the group id of com.github.javaparser-- so possibly both exist?
would really prefer if you stay around rather than "exit" completely!!
Danny van Bruggen
@matozoid
Good one
Updated the issue
Yeah, I'm hovering around until I feel I'm no longer useful :-)