@Delegate generate a <T extends .java.lang.Object> who doen't compile #414

Closed
lombokissues opened this Issue Jul 14, 2015 · 3 comments

Projects

None yet

1 participant

@lombokissues
Collaborator

Migrated from Google Code (issue 341)

@lombokissues
Collaborator

👤 william.delanoue   🕗 Feb 07, 2012 at 11:44 UTC

What steps will reproduce the problem?

  1. the java file :

import javax.sql.DataSource;

import lombok.Delegate;
import lombok.RequiredArgsConstructor;

@ RequiredArgsConstructor
public class DataSourceWrapper implements DataSource {
@ Delegate
private final DataSource target;

}

  1. Use Delombok (with maven), it generate :

public class DataSourceWrapper implements DataSource {
private final DataSource target;

    @ java.beans.ConstructorProperties({&quot;target&quot;})
    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public DataSourceWrapper(final DataSource target) {
            this.target = target;
    }

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public java.sql.Connection getConnection() throws java.sql.SQLException {
            return this.target.getConnection();
    }

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public java.sql.Connection getConnection(final java.lang.String arg0, final java.lang.String arg1) throws java.sql.SQLException {
            return this.target.getConnection(arg0, arg1);
    }

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public java.io.PrintWriter getLogWriter() throws java.sql.SQLException {
            return this.target.getLogWriter();
    }

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public void setLogWriter(final java.io.PrintWriter arg0) throws java.sql.SQLException {
            this.target.setLogWriter(arg0);
    }

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public void setLoginTimeout(final int arg0) throws java.sql.SQLException {
            this.target.setLoginTimeout(arg0);
    }

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public int getLoginTimeout() throws java.sql.SQLException {
            return this.target.getLoginTimeout();
    }

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public &lt;T extends .java.lang.Object&gt;T unwrap(final java.lang.Class&lt;T&gt; arg0) throws java.sql.SQLException {
            return this.target.&lt;T&gt;unwrap(arg0);
    }

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public boolean isWrapperFor(final java.lang.Class&lt;?&gt; arg0) throws java.sql.SQLException {
            return this.target.isWrapperFor(arg0);
    }

}

  1. compile and...

DataSourceWrapper.java:[55,19] illegal start of type

What is the expected output? What do you see instead?

    @ java.lang.SuppressWarnings(&quot;all&quot;)
    public &lt;T extends .java.lang.Object&gt;T unwrap(final java.lang.Class&lt;T&gt; arg0) throws java.sql.SQLException {
            return this.target.&lt;T&gt;unwrap(arg0);
    }

there is a ".java.lang.Object" who doesn't compile

What version of the product are you using? On what operating system?

10.8, on linux ubuntu 11.10 64b

Please provide any additional information below.

Datasource is an extends of two interface :
public interface DataSource extends CommonDataSource,Wrapper {

the "Wrapper" contains the method

    &lt;T&gt; T unwrap(java.lang.Class&lt;T&gt; iface) throws java.sql.SQLException;

who make lombok in troubles.

@lombokissues
Collaborator

👤 askoning   🕗 Feb 27, 2012 at 20:58 UTC

We avoided this problem in most places already. Turns out one slipped through.
Fixed this particularly nasty occurrence (786a6ff); will be in version-after-0.10.8

@lombokissues lombokissues added this to the 0.10.9 milestone Jul 14, 2015
@lombokissues
Collaborator

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment