简体   繁体   中英

Groovy not compiling correct class in Intellij

I have a class named "OrderBy" localized on package "br.com.petrobras.sddi.domain.".

Groovy has a class named "OrderBy" too, on package "groovy.util"

I have the class above:

    //.. something
    import br.com.petrobras.sddi.domain.*
   // other imports

    abstract class BaseJPARepository {

    protected OrderSpecifier getSortedColumn(OrderBy order) {
       //..something
    }
}

When I compiled my program and open BaseJPARepository.class the imports contains

import br.com.petrobras.sddi.domain.FindAllPredicate;
import br.com.petrobras.sddi.domain.IEntity;
import br.com.petrobras.sddi.domain.PagedList;
import br.com.petrobras.sddi.domain.Pagination;
import com.querydsl.core.types.Order;
// others
import groovy.util.OrderBy;
// others...

So, when compiling, my class OrderBy wasn't imported. How can I fix that? (I want to use the "*" when importing)

AFAIK, groovy loads all groovy.util.* and java.lang.* etc classes automatically. So, in order to be able to use your class you have to use it's full name in the code:

 protected OrderSpecifier getSortedColumn( br.com.petrobras.sddi.domain.OrderBy order) {
   //..something
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM