danfickle / danfickle/cpp-to-java-source-converter
CPPClassType cannot be cast to ICPPConstructor
- 主要語言
- Java
- 星號
- 51
- 分支
- 33
- PR 合併指標
- 30 天內沒有已合併 PR
描述
First of all, not sure if I am setting this up correctly, as there were no instructions really. I created a folder "\home\daniel\workspace\cpp-to-java-source-converter" and put the repository (master branch) there. I then ran "mvn clean package". I found I needed to create a directory called "crap" under the root directory and put an empty file "test-statements.java" there, as this is expected. I changed to the target directory to run:
`D:\home\daniel\workspace\cpp-to-java-source-converter\target>java -cp cpp-to-java-source-converter-0.1-SNAPSHOT.jar;..\lib\* com.github.danfickle.cpptojavasourceconverter.Main`
Secondly, it doesn't seem to work, due to a class cast exception. Here is the output I get:
```
D:\home\daniel\workspace\cpp-to-java-source-converter\target>java -cp cpp-to-jav
a-source-converter-0.1-SNAPSHOT.jar;..\lib\* com.github.danfickle.cpptojavasourc
econverter.Main
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-bitfield.cp
p
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType cannot be cast to org.
eclipse.cdt.core.dom.ast.cpp.ICPPConstructor
java.lang.ClassCastException: org.eclipse.cdt.internal.core.dom.parser.cpp.CPPCl
assType cannot be cast to org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor
at com.github.danfickle.cpptojavasourceconverter.ExpressionEvaluator.eva
lExprNew(ExpressionEvaluator.java:162)
at com.github.danfickle.cpptojavasourceconverter.ExpressionEvaluator.eva
l1Expr(ExpressionEvaluator.java:67)
at com.github.danfickle.cpptojavasourceconverter.InitializationManager.e
val1Init(InitializationManager.java:76)
at com.github.danfickle.cpptojavasourceconverter.SourceConverter.evaluat
eDeclarationReturnInitializers(SourceConverter.java:282)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.evalStmt(
StmtEvaluator.java:141)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.evalStmt(
StmtEvaluator.java:123)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.eval1Stmt
(StmtEvaluator.java:25)
at com.github.danfickle.cpptojavasourceconverter.FunctionManager.evalFun
ction(FunctionManager.java:162)
at com.github.danfickle.cpptojavasourceconverter.SourceConverter.evalDec
laration(SourceConverter.java:299)
at com.github.danfickle.cpptojavasourceconverter.Traverser.traverse(Trav
erser.java:50)
at com.github.danfickle.cpptojavasourceconverter.Main.main(Main.java:37)
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
Failure to determine type of expression
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-operator-ov
erloading.cpp
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType cannot be cast to org.
eclipse.cdt.core.dom.ast.cpp.ICPPConstructor
java.lang.ClassCastException: org.eclipse.cdt.internal.core.dom.parser.cpp.CPPCl
assType cannot be cast to org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor
at com.github.danfickle.cpptojavasourceconverter.ExpressionEvaluator.eva
lExprNew(ExpressionEvaluator.java:162)
at com.github.danfickle.cpptojavasourceconverter.ExpressionEvaluator.eva
l1Expr(ExpressionEvaluator.java:67)
at com.github.danfickle.cpptojavasourceconverter.InitializationManager.e
val1Init(InitializationManager.java:76)
at com.github.danfickle.cpptojavasourceconverter.SourceConverter.evaluat
eDeclarationReturnInitializers(SourceConverter.java:282)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.evalStmt(
StmtEvaluator.java:141)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.evalStmt(
StmtEvaluator.java:123)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.eval1Stmt
(StmtEvaluator.java:25)
at com.github.danfickle.cpptojavasourceconverter.FunctionManager.evalFun
ction(FunctionManager.java:162)
at com.github.danfickle.cpptojavasourceconverter.SourceConverter.evalDec
laration(SourceConverter.java:299)
at com.github.danfickle.cpptojavasourceconverter.Traverser.traverse(Trav
erser.java:50)
at com.github.danfickle.cpptojavasourceconverter.Main.main(Main.java:37)
In: D:\home\daniel\workspace\cpp-to-java-source-converter\tests\test-expressions
.cpp
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType cannot be cast to org.
eclipse.cdt.core.dom.ast.cpp.ICPPConstructor
java.lang.ClassCastException: org.eclipse.cdt.internal.core.dom.parser.cpp.CPPCl
assType cannot be cast to org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor
at com.github.danfickle.cpptojavasourceconverter.ExpressionEvaluator.eva
lExprNew(ExpressionEvaluator.java:143)
at com.github.danfickle.cpptojavasourceconverter.ExpressionEvaluator.eva
l1Expr(ExpressionEvaluator.java:67)
at com.github.danfickle.cpptojavasourceconverter.ExpressionEvaluator.eva
lExprBinary(ExpressionEvaluator.java:1158)
at com.github.danfickle.cpptojavasourceconverter.ExpressionEvaluator.eva
l1Expr(ExpressionEvaluator.java:59)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.evalStmt(
StmtEvaluator.java:177)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.evalStmt(
StmtEvaluator.java:123)
at com.github.danfickle.cpptojavasourceconverter.StmtEvaluator.eval1Stmt
(StmtEvaluator.java:25)
at com.github.danfickle.cpptojavasourceconverter.FunctionManager.evalFun
ction(FunctionManager.java:162)
at com.github.danfickle.cpptojavasourceconverter.SourceConverter.evalDec
laration(SourceConverter.java:299)
at com.github.danfickle.cpptojavasourceconverter.SourceConverter.evalDec
lSpecifier(SourceConverter.java:668)
at com.github.danfickle.cpptojavasourceconverter.SourceConverter.evalDec
laration(SourceConverter.java:313)
at com.github.danfickle.cpptojavasourceconverter.Traverser.traverse(Trav
erser.java:50)
at com.github.danfickle.cpptojavasourceconverter.Main.main(Main.java:37)
D:\home\daniel\workspace\cpp-to-java-source-converter\target>
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
Reproduce the failure with `mvn clean package` and the `com.github.danfickle.cpptojavasourceconverter.Main` entry point. Inspect `ExpressionEvaluator.java` at `evalExprNew` lines 143 and 162, then compare failures from `tests/test-bitfield.cpp`, `tests/test-operator-overloading.cpp`, and `tests/test-expressions.cpp`. Done means these inputs no longer produce the reported `ClassCastException` or repeated expression-type failures.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- cpp, java
- 領域
- compilers
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 35/100