Hi

I've been trying to update cc-mode to Java 7.

There are a couple of Java language changes in 7:

- One language change seems to work out of the box, you can omit generic declarations in some cases:

Foo<Long> f = new Foo<>();

Two other changes should hopefully be easy to implement (if I could just find out how numeric literals are parsed):

- Binary literals are allowed, they should start with "0b".

- You can have underscores in numeric literals, ie 0xCA_FE_BA_BE or 0b000_00001_0000_0001

This I think I have a fix for:

- "try" can be followed by a resource block:

try (Foo f = new AutoFoo()) {
...
}

And lastly there can be many exceptions in a catch clause:

catch (FooException | BarException | BazException b) {
...
}

the last one seems to be the biggest one. If I read the cc-langs.el correctly "catch" is defined as a statement that is followed by a paren sexp followed by a block. However that paren sexp need special treatment because the format is not valid in any other place in java.

Some questions:

1) where can I find the definition for how numerical literals are parsed?

2) where is a good place to start looking how the paren sexp in catch is parsed?

Lastly, my "fix" for the 4:th case ("try" now appears in two places but it looks like that is ok):

--- orig-ccmode/cc-langs.el 2011-10-12 12:19:57.000000000 +0200
+++ ccmode/cc-langs.el 2011-11-23 18:08:47.945067211 +0100
@@ -2155,7 +2155,7 @@
"Statement keywords followed by a paren sexp and then by a substatement."
t '("for" "if" "switch" "while")
c++ '("for" "if" "switch" "while" "catch")
- java '("for" "if" "switch" "while" "catch" "synchronized")
+ java '("for" "if" "switch" "while" "catch" "synchronized" "try")
idl nil
pike '("for" "if" "switch" "while" "foreach")
awk '("for" "if" "while"))

cheers
/Joel