New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
1 participant
@lombokissues
Collaborator

lombokissues commented Jul 14, 2015

Migrated from Google Code (issue 341)

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

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.

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

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

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

End of migration

Collaborator

lombokissues commented Jul 14, 2015

End of migration

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