• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Compiler
  4. Java Corpus Tools

Page History

Versions Compared

Old Version 44

changes.mady.by.user J. Duke

Saved on Jul 22, 2012

compared with

New Version 45

changes.mady.by.user J. Duke

Saved on Jul 23, 2012

  • Previous Change: Difference between versions 43 and 44
  • Next Change: Difference between versions 45 and 46
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Improved Exception Handling

Java 7 introduced an improved checking for rethrown exceptions. Previously, a rethrown exception was treated as throwing the type of the catch parameter. Now, when a catch parameter is declared final, the type is known to be only the exception types that were thrown in the try block and are a subtype of the catch parameter type.
This new feature introduced two source incompatibility with respect to Java 6. The code below illustrates the changes. Previously, the statement throw exception would throw a Foo exception. Now, it throws a DaughterOfFoo exception. As a consequence, the catch block catch(SonOfFoo anotherException) is not reachable anymore as the try only throws a DaughterOfFoo exception.

Code Block

class Foo extends Exception {}
class SonOfFoo extends Foo {}
class DaughterOfFoo extends Foo {}
class Test {
    void test() {
        try {
            throw new DaughterOfFoo();
        } catch (Foo exception) {
            try {
                throw exception; // first incompatibility
            } catch (SonOfFoo anotherException) { 
                // second incompatibility: is this block reachable?
            }
        }
    }
}

Java 7 introduced an improved checking for rethrown exceptions. Previously, a rethrown exception was treated as throwing the type of the catch parameter. Now, when a catch parameter is declared final, the type is known to be only the exception types that were thrown in the try block and are a subtype of the catch parameter type.

This new feature introduced two source incompatibility with respect to Java 6. The code below illustrates the changes. Previously, the statement throw exception would throw a Foo exception. Now, it throws a DaughterOfFoo exception. As a consequence, the catch block catch(SonOfFoo anotherException) is not reachable anymore as the try only throws a DaughterOfFoo exception.

Use Case 6:

Evaluation

 

Final Array & Anonymous Class

Generic Constructors

Capture Conversion Idiom

Overloaded Methods

Covariant Arrays

Improved Exception Handling

JTL

 

X

X

 

X

 

BBQ

X

X

X

?

X

 

SOUL

 

 

 

 

 

 

JQuery

X

X

X

?

X

 

.QL

 

 

 

 

X

 

Jackpot

 

 

 

 

 

 

PMD

 

 

 

 

X

 

...

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 536, "requestCorrelationId": "653c5f0bbc2e85f6"}