2012-01-01 43 views
1

我一直从AndEngine项目克隆库后,收到此错误..枚举类型是不通用的错误克隆andengine

的类型枚举不是通用的;它不能与参数进行参数<BoundsSplit>

这里就是错误仍然存​​在的类。

package org.andengine.util.spatial.adt.bounds; //The error points at the beginning of this line. 
import org.andengine.util.exception.AndEngineException; 

/** 
* (c) Zynga 2011 
* 
* @author Nicolas Gramlich <[email protected]> 
* @since 21:13:32 - 11.10.2011 
*/ 
public enum BoundsSplit { 
// =========================================================== 
// Elements 
// =========================================================== 

TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT; 

// =========================================================== 
// Constants 
// =========================================================== 

// =========================================================== 
// Fields 
// =========================================================== 

// =========================================================== 
// Constructors 
// =========================================================== 

// =========================================================== 
// Getter & Setter 
// =========================================================== 

// =========================================================== 
// Methods for/from SuperClass/Interfaces 
// =========================================================== 

// =========================================================== 
// Methods 
// =========================================================== 

// =========================================================== 
// Inner and Anonymous Classes 
// =========================================================== 

public static class BoundsSplitException extends AndEngineException { 
    // =========================================================== 
    // Constants 
    // =========================================================== 

    private static final long serialVersionUID = 7970869239897412727L; 

    // =========================================================== 
    // Fields 
    // =========================================================== 

    // =========================================================== 
    // Constructors 
    // =========================================================== 

    // =========================================================== 
    // Getter & Setter 
    // =========================================================== 

    // =========================================================== 
    // Methods for/from SuperClass/Interfaces 
    // =========================================================== 

    // =========================================================== 
    // Methods 
    // =========================================================== 

    // =========================================================== 
    // Inner and Anonymous Classes 
    // =========================================================== 
} 

}

编辑:

这里更多的是对什么错误说

Multiple markers at this line 
- The type java.lang.Enum cannot be resolved. It is indirectly referenced from 
required .class files 
- The type Enum is not generic; it cannot be parameterized with arguments 
<BoundsSplit> 
- The type java.lang.Object cannot be resolved. It is indirectly referenced from 
required .class files 
- The type java.lang.Enum cannot be resolved. It is indirectly referenced from 
required .class files 
+0

当你声明Java中的'enum'中的成员,在那个'enum'中声明合适的构造函数是强制性的,无论你是否明确地声明它是'private',都是*'always'''''。你在'enum'中提供了一个合适的构造函数吗? – Lion 2012-01-01 19:02:58

+0

我所做的只是从https://github.com/twalkerjr22/AndEngine克隆一个存储库,并且错误不断出现。我从来没有得到过它。 – 2012-01-01 19:06:04

+0

查看我刚添加的新编辑 – 2012-01-01 19:25:46

回答

4

好了,似乎这个错误有多方面的原因。搜索网页(Here)的主要原因是项目目录中的.classpath文件错误 - 我也是这样。这可能是AndEngine的项目有错误的文件,因为您说在更新它时遇到了这个问题。

所以,你可以:

  1. 解决它。 This页面对问题有一个很好的解释,请检查一下。你可以得到更多的信息here
  2. 而不是在eclipse中导入AndEngine源代码到你的工作空间(我猜你是这样做的,因为这可能是问题的根源),你可以链接源文件夹,然后eclipse不会检查AndEngine项目文件这可能是错误的)。

另一个原因可能是因为错误配置的JRE系统库。有一个很好的教程,如何解决这个问题here

顺便说一句,这个问题是偏食有关,所以我会用eclipse标签重新标记您的问题,所以如果我的回答不会帮助 - 至少你会得到更好的:)

+0

Dude!我发誓你是一个LIFESAVER!关于JRE系统库丢失的最后一个链接!!谢谢! – 2012-01-01 20:03:53

+0

很高兴能帮到:) – Jong 2012-01-01 20:09:48

+0

还有一个问题,我们是否想用新的AndEngine GLES2作为jar或图书馆?如果是的话,我们如何使用它作为图书馆? http://www.andengine.org/forums/gles2/use-andengine-as-a-android-library-project-not-as-a-jar-t6142.html – 2012-01-01 20:12:37