如何使用spoon编译hadoop项目

fykwrbwg  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(419)

我是勺子和阿斯特的新用户。最近我使用astor(spoonlabs/astor)来做一些自动的bug修复工作。
astor将首先使用spoon库来编译和分析项目源代码。现在我可以使用spoon成功地合成小项目,但是它不能成功地编译hadoop子模块(例如hadoop/hadoop common project/hadoop auth)。
我发现spoon在编译模型时有问题。似乎spoon无法从package-info.java文件中获取声明的类型。有人知道如何解决这个问题吗?谢谢!
日志信息如下:

2017-08-30 17:59:15,128 INFO main - building model: /Users/someone/git/astor/./outputMutation/AstorMain-11859hadp//src//default, compliance level: 8
2017-08-30 17:59:15,136 INFO main - Classpath for building SpoonModel [too long to list all of them]
2017-08-30 17:59:16,885 ERROR main - Problem compiling the model with compliance level 8
2017-08-30 17:59:16,885 ERROR main - inconsistent compilation unit: '/Users/someone/git/astor/outputMutation/AstorMain-11859hadp/src/default/org/apache/hadoop/security/authentication/server/package-info.java': declared types are []
2017-08-30 17:59:16,885 INFO main - building model: /Users/someone/git/astor/./outputMutation/AstorMain-11859hadp//src//default, compliance level: 7
2017-08-30 17:59:16,887 INFO main - Classpath for building SpoonModel [too long to list all of them]
Exception in thread "main" java.lang.RuntimeException: inconsistent compilation unit: '/Users/someone/git/astor/outputMutation/AstorMain-11859hadp/src/default/org/apache/hadoop/security/authentication/server/package-info.java': declared types are []
    at spoon.support.reflect.cu.CompilationUnitImpl.getMainType(CompilationUnitImpl.java:68)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.generateProcessedSourceFilesUsingCUs(JDTBasedSpoonCompiler.java:498)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.generateProcessedSourceFiles(JDTBasedSpoonCompiler.java:203)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.generateProcessedSourceFiles(JDTBasedSpoonCompiler.java:192)
    at fr.inria.astor.core.manipulation.MutationSupporter.buildModel(MutationSupporter.java:90)
    at fr.inria.astor.core.manipulation.MutationSupporter.buildModel(MutationSupporter.java:71)
    at fr.inria.astor.approaches.jgenprog.JGenProg.initModel(JGenProg.java:152)
    at fr.inria.astor.approaches.jgenprog.JGenProg.createInitialPopulation(JGenProg.java:62)
    at fr.inria.main.evolution.AstorMain.createEngine(AstorMain.java:97)
    at fr.inria.main.evolution.AstorMain.run(AstorMain.java:142)
    at fr.inria.main.AbstractMain.executeExample(AbstractMain.java:708)
    at fr.inria.main.evolution.AstorMain.execute(AstorMain.java:209)
    at fr.inria.main.evolution.AstorMain.main(AstorMain.java:199)
    at fr.inria.main.evolution.MainjGenProg.main(MainjGenProg.java:14)

package-info.java文件:

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Provides the server-side framework for authentication.
 */
@InterfaceAudience.LimitedPrivate({ "HBase", "HDFS", "MapReduce" })
@InterfaceStability.Evolving
package org.apache.hadoop.security.authentication.server;

import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
n9vozmp4

n9vozmp41#

我不认为stackoverflow是解决你问题的合适地方:它要么是勺子里的虫子,要么是astor里的虫子。我建议你在阿斯特开题(https://github.com/spoonlabs/astor/issues)首先,我们要看看是阿斯特还是斯彭。如果可以,在创建问题时,请提供与astor一起使用的完整命令行参数,这样我就可以轻松地复制您的bug。

相关问题