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

Validation exception when altering message of NotNull #194

Closed
krzyk opened this issue Nov 5, 2015 · 43 comments
Closed

Validation exception when altering message of NotNull #194

krzyk opened this issue Nov 5, 2015 · 43 comments

Comments

@krzyk
Copy link

krzyk commented Nov 5, 2015

Following test will fail if using jcabi-aspects 0.22.2 (and 0.22.1), but works on 0.21.1:

import javax.validation.constraints.NotNull;
import org.junit.Test;

public final class FooTest {
    @Test
    public void test() {
        new Bar().test("");
    }
}

interface Foo {
    void test(@NotNull(message = "foo") String value);
}

class Bar implements Foo {
    @Override
    public void test(@NotNull final String value) {
        System.out.println(value);
    }
}

dependencies:

        <dependency>                                                            
            <groupId>com.jcabi</groupId>                                        
            <artifactId>jcabi-aspects</artifactId>                              
            <version>0.22.2</version>                                           
        </dependency>                                                           
        <dependency>                                                            
            <groupId>javax.validation</groupId>                                 
            <artifactId>validation-api</artifactId>                             
            <version>1.1.0.Final</version>                                      
        </dependency>                                                           
        <dependency>                                                            
            <groupId>org.hibernate</groupId>                                    
            <artifactId>hibernate-validator</artifactId>                        
            <version>5.2.1.Final</version>                                      
        </dependency>                                                           
        <dependency>                                                            
            <groupId>javax.el</groupId>                                         
            <artifactId>javax.el-api</artifactId>                               
            <version>3.0.1-b04</version>                                        
        </dependency>                                  

build plugin:

            <plugin>                                                            
                <groupId>com.jcabi</groupId>                                    
                <artifactId>jcabi-maven-plugin</artifactId>                     
                <executions>                                                    
                    <execution>                                                 
                        <id>jcabi-ajc-compile</id>                              
                        <phase>process-classes</phase>                          
                        <goals>                                                 
                            <goal>ajc</goal>                                    
                        </goals>                                                
                        <configuration>                                         
                            <tempDirectory>${project.build.directory}/jcabi-ajc</tempDirectory>
                            <classesDirectory>${project.build.outputDirectory}</classesDirectory>
                            <aspectsDirectories>                                
                                <directory>${project.basedir}/src/main/aspect</directory>
                            </aspectsDirectories>                               
                        </configuration>                                        
                    </execution>                                                
                    <execution>                                                 
                        <id>jcabi-ajc-test-compile</id>                         
                        <phase>process-test-classes</phase>                     
                        <goals>                                                 
                            <goal>ajc</goal>                                    
                        </goals>                                                
                        <configuration>                                         
                            <tempDirectory>${project.build.directory}/jcabi-ajc-test</tempDirectory>
                            <classesDirectory>${project.build.testOutputDirectory}</classesDirectory>
                            <aspectsDirectories>                                
                                <directory>${project.basedir}/src/main/aspect</directory>
                                <directory>${project.basedir}/src/test/aspect</directory>
                            </aspectsDirectories>                               
                            <scopes>                                            
                                <scope>compile</scope>                          
                                <scope>provided</scope>                         
                                <scope>system</scope>                           
                                <scope>runtime</scope>                          
                                <scope>test</scope>                             
                            </scopes>                                           
                        </configuration>                                        
                    </execution>                                                
                </executions>                                                   
                <dependencies>                                                  
                <dependency>                                                    
                    <groupId>org.hibernate</groupId>                            
                    <artifactId>hibernate-validator</artifactId>                
                    <version>5.2.2.Final</version>                              
                    <scope>runtime</scope>                                      
                </dependency>                                                   
            </dependencies>                                                                                                                                                                   
            </plugin>

with

 HV000151: A method overriding another method must not alter the parameter constraint configuration, but method public void com.package.Bar.test(java.lang.String) changes the configuration of public abstract void com.package.Foo.test(java.lang.String).

Overriding message in inheriting classes is very popular (e.g. guava does that in few places) so please remove this constraint.


- `194-8b58eead`/#204 (by Ievgen Degtiarenko)
@pinaf
Copy link

pinaf commented Nov 9, 2015

@yegor256 can we dispatch this one? it is needed for another project.

@yegor256 yegor256 added the bug label Nov 10, 2015
@dmarkov
Copy link

dmarkov commented Nov 13, 2015

@krzyk I am aware of the task, give me some time to find a developer...

@dmarkov
Copy link

dmarkov commented Nov 13, 2015

@krzyk thanks for reporting! I topped your account for 15 mins, transaction 69586722

@pinaf
Copy link

pinaf commented Nov 29, 2015

@yegor256 can we dispatch this one?

@dmarkov
Copy link

dmarkov commented Dec 1, 2015

@olegsimanov it's yours now, please proceed keeping in mind our principles. Feel free to ask any technical questions right here in the ticket. The budget here is 30 mins, which is exactly how much time will be paid for, when the task is completed

@olegsimanov
Copy link

Please have a look at this pull request:
#198

@dmarkov
Copy link

dmarkov commented Dec 16, 2015

@olegsimanov the ticket is with you for 15 days already. If it is not finished in the next 48 hours, it will be re-assigned to someone else, see No Obligations principle, this article should help if you're stuck... -30 added to your rating, at the moment it is: -210

@pinaf
Copy link

pinaf commented Dec 19, 2015

@krzyk :(

@pinaf
Copy link

pinaf commented Dec 28, 2015

@krzyk maybe reassign it?

@krzyk
Copy link
Author

krzyk commented Dec 28, 2015

@pinaf it's up to @dmarkov :)

@pinaf
Copy link

pinaf commented Jan 1, 2016

@krzyk I have a feeling you can ask him to reassign

@krzyk
Copy link
Author

krzyk commented Jan 1, 2016

@dmarkov please assign someone else

@pinaf
Copy link

pinaf commented Jan 1, 2016

@krzyk no that will remove points from you hehe

@pinaf
Copy link

pinaf commented Jan 1, 2016

@dmarkov try reassign the issue

@krzyk
Copy link
Author

krzyk commented Jan 1, 2016

@pinaf but it is not assigned to me and I'm not architect here so why would @dmarkov listen to me? :)

@pinaf
Copy link

pinaf commented Jan 1, 2016

@krzyk ooops...

@dmarkov
Copy link

dmarkov commented Jan 4, 2016

@dmarkov please assign someone else

@krzyk got it, someone else will be assigned soon

@pinaf
Copy link

pinaf commented Jan 4, 2016

@yegor256 Could we assign this one? it is holding back at least 1 issue in another project.

@yegor256
Copy link
Member

yegor256 commented Jan 4, 2016

@dmarkov pls assign @dmzaytsev to this problem

@dmzaytsev
Copy link
Contributor

@yegor256 I have no idea how to disable a particular constraint for javax.validation.Validator.
can you assist here?
I can catch the exception in https://github.com/jcabi/jcabi-aspects/blob/master/src/main/java/com/jcabi/aspects/aj/MethodValidator.java#L155, but it's not good decision

@yegor256
Copy link
Member

yegor256 commented Jan 4, 2016

@dmzaytsev I have no idea either :( honestly, I'm a bit disappointed by this entire validation API... @krzyk maybe you can suggest something?

@dmarkov
Copy link

dmarkov commented Jan 5, 2016

@dmarkov pls assign @dmzaytsev to this problem

@yegor256 done. @dmzaytsev you are assigned to this task. please proceed...

@krzyk
Copy link
Author

krzyk commented Jan 5, 2016

@yegor256 sorry, I don't have good options. @dmzaytsev Maybe we could create issue in https://hibernate.atlassian.net/projects/HV/issues/HV-840?filter=allopenissues for that?

@dmzaytsev
Copy link
Contributor

dmzaytsev commented Jan 5, 2016 via email

@pinaf
Copy link

pinaf commented Jan 6, 2016

@krzyk is this workaround acceptable?

@krzyk
Copy link
Author

krzyk commented Jan 7, 2016

@dmzaytsev @pinaf good enough for now

@pinaf
Copy link

pinaf commented Jan 8, 2016

@dmzaytsev please catch the exception for now then

dmzaytsev added a commit to dmzaytsev/jcabi-aspects that referenced this issue Jan 8, 2016
@dmzaytsev
Copy link
Contributor

@pinaf done :)

@dmzaytsev
Copy link
Contributor

@dmarkov please see PR #202

dmzaytsev added a commit to dmzaytsev/jcabi-aspects that referenced this issue Jan 8, 2016
@dmarkov
Copy link

dmarkov commented Jan 8, 2016

@dmarkov please see PR #202

@dmzaytsev will take a look, thanks

dmzaytsev added a commit to dmzaytsev/jcabi-aspects that referenced this issue Jan 8, 2016
dmzaytsev added a commit to dmzaytsev/jcabi-aspects that referenced this issue Jan 8, 2016
@dmzaytsev
Copy link
Contributor

@krzyk fixed in PR #202 please close if alright

@krzyk
Copy link
Author

krzyk commented Jan 8, 2016

@dmzaytsev thanks

@krzyk krzyk closed this as completed Jan 8, 2016
@pinaf
Copy link

pinaf commented Jan 8, 2016

@krzyk could we get a new release with this fix?

@krzyk
Copy link
Author

krzyk commented Jan 8, 2016

@pinaf it's not up to me :) @yegor256 can you release this fix?

@pinaf
Copy link

pinaf commented Jan 8, 2016

@krzyk argh, sorry again. No idea why I keep thinking you are the architect here!

@pinaf
Copy link

pinaf commented Jan 10, 2016

@yegor256 could we get a new release?

@yegor256
Copy link
Member

@rultor release, tag is 0.22.3

@rultor
Copy link
Contributor

rultor commented Jan 11, 2016

@rultor release, tag is 0.22.3

@yegor256 OK, I will release it now. Please check the progress here

@rultor
Copy link
Contributor

rultor commented Jan 11, 2016

@rultor release, tag is 0.22.3

@yegor256 Done! FYI, the full log is here (took me 18min)

@dmarkov
Copy link

dmarkov commented Jan 11, 2016

@krzyk once 194-8b58eead/#204 puzzle is resolved (later, in another ticket), this ticket will be fully complete

@pinaf
Copy link

pinaf commented Jan 11, 2016

@yegor256 thanks!

@dmarkov
Copy link

dmarkov commented Jan 12, 2016

@dmzaytsev I just added 30 mins to your account, many thanks for your contribution (74441255).. 144 hours and 10 mins spent here; +30 added to your rating, current score is: +1703

@dmarkov
Copy link

dmarkov commented Mar 7, 2016

@krzyk the last puzzle 194-8b58eead/#204 originated from here solved

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

No branches or pull requests

7 participants