Skip to content
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
Closed
Milestone

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 341)

@lombokissues
Copy link
Author

👤 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
Copy link
Author

👤 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
Copy link
Author

End of migration

lianhaijun pushed a commit to lianhaijun/lombok that referenced this issue May 8, 2020
* projectlombok#412: added failing test for @wither and @accessors(fluent=true)
* projectlombok#412: fixing WitherProcessor and WitherFieldProcessor so that they do not take into account @accessors(fluent=true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant