Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8079115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:00:21+00:00 2026-06-05T16:00:21+00:00

I am using a simple try-with-resources statement like the following: try (final CSVWriter w

  • 0

I am using a simple try-with-resources statement like the following:

try (final CSVWriter w = new CSVWriter(new OutputStreamWriter(r.getOutputStream(), "UTF-8"));){
    //do stuff......
}

It compiles fine using a normal javac Ant task, but when I have Clover instrument the code first, the resultant code no longer compiles (see the compilation message included below).

According to the docs, this version of Clover does support Java 7. Has anyone else run across this issue or have any idea what the problem is?

Java version:

java version "1.7.0"
Java(TM) SE Runtime Environment (build pxi3270-20110827_01)
IBM J9 VM (build 2.6, JRE 1.7.0 Linux x86-32 20110810_88604 (JIT enabled, AOT enabled)
J9VM - R26_Java726_GA_20110810_1208_B88592
JIT  - r11_20110810_20466
GC   - R26_Java726_GA_20110810_1208_B88592
J9CL - 20110810_88604)
JCL - 20110809_01 based on Oracle 7b147

Output of Ant task:

compile:
     [echo] Compiling source code...
    [javac] Compiling 135 source files to /home/*********/WEB-INF/classes
   [clover] Clover Version 3.1.2, built on November 07 2011 (build-842)
   [clover] Loaded from: /home/*******/clover.jar
   [clover] Clover: Commercial License registered to *******.
   [clover] Updating existing database at '/home/********/dist/clover/clover.db'.
   [clover] Processing files at 1.7 source level.
   [clover] Clover all over. Instrumented 135 files (12 packages).
   [clover] Elapsed time = 1.597 secs. (84.534 files/sec, 12,463.369 srclines/sec)
    [javac] /tmp/clover2218935617827048125.tmp/com/****/web/DownloadService.java:232: error: illegal start of type
    [javac]                 __CLR3_1_24ae4aegwpi0zhh.R.inc(5592);try (new java.lang.AutoCloseable() {{__CLR3_1_24ae4aegwpi0zhh.R.inc(5593);}public void close(){}};CSVWriter w = new CSVWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8"));){
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:00:23+00:00Added an answer on June 5, 2026 at 4:00 pm

    It seems that using optional trailing semicolon to terminate resources list in try-with-resources is not allowed with your JDK version, it’s illegal under JSR 334.

    Check this documentation :

    SYNTAX: The existing set of grammar productions for TryStatement in JLS §14.20 is augmented with:

    TryStatement:
        try ResourceSpecification Block Catchesopt Finallyopt 
    
    Supporting new grammar productions are added:
    
    ResourceSpecification:
        ( Resources ) 
    Resources:
        Resource 
        Resource ; Resources 
    Resource:
        VariableModifiers Type VariableDeclaratorId = Expression 
        Expression 
    

    [An implication of the combined grammar is that a try statement must have at least one of a catch clause, a finally block, and a resource specification. Furthermore, it is permissible for a try statement to have exactly one of these three components. Note that it is illegal to have a trailing semi-colon in the resource specification.]

    Try to drop the last semicolon :

    try (final CSVWriter w = new CSVWriter(new OutputStreamWriter(r.getOutputStream(), "UTF-8"))){
    //do stuff......
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to create a very simple app using windows API. I've done some
I thought I'd try a simple GUI app using the world/universe mutation-free approach, but
I am using something like the above sample code but when i try to
Using simple type like class A { public int X, Y; } with object
I am using simple insert statement to insert value to CLOB varaible, anyway i
I'm writing a simple IRC bot to try to learn more about Clojure, using
Using simple field width specifier, the columns are 'thinner' when the string includes 'European'
When using simple request to post to Twitter the messages are signed with sent
I am using simple order by clause to show products according to available quantity
I have started using Simple-form and Bootstrap and I have tried to follow this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.