0

JFreeChart デモのコーディングを、プロジェクト内で作成したクラスにコピーして作成しました。

java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: (<any>)voidコードをコンパイルしようとすると、エラーが発生します。

完全なエラーは以下のとおりです。

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code -      Erroneous sym type: (<any>)void
at JFreeChartExample.<init>(JFreeChartExample.java:32)
at JFreeChartExample.main(JFreeChartExample.java:45)
Java Result: 1

Line java:32 -plot.setDirection(Rotation.CLOCKWISE);

コードを開いてsetDirectionを強調表示すると、The type of setDirection(Rotation) is erroneous

以下は、デモのコーディングです。

import javax.swing.JFrame;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.util.Rotation;

public class JFreeChartExample extends JFrame {

    public JFreeChartExample(String frameTitle, String chartTitle) {
        super(frameTitle);
        //Creates a sample defaultPieDataset
        DefaultPieDataset defaultPieDataset = new DefaultPieDataset();
        defaultPieDataset.setValue("c/c++", 19);
        defaultPieDataset.setValue("java", 46);
        defaultPieDataset.setValue("php", 35);

        // based on the defaultPieDataset we create the chart
        JFreeChart pieChart = ChartFactory.createPieChart3D(chartTitle, defaultPieDataset, true, true, false);
        PiePlot plot = (PiePlot) pieChart.getPlot();
        plot.setStartAngle(290);
        plot.setDirection(Rotation.CLOCKWISE);
        plot.setForegroundAlpha(0.5f);

        // Adding chart into a chart panel
        ChartPanel chartPanel = new ChartPanel(pieChart);

        // setting default size
        chartPanel.setPreferredSize(new java.awt.Dimension(300, 200));

        // add to contentPane
        setContentPane(chartPanel);
    }

    public static void main(String[] args) {
        JFreeChartExample chart = new JFreeChartExample("Language Usage Statistics", "Which language are you Learning?");
        chart.pack();
        chart.setVisible(true);
    }
}

jcommon-1.018.jar と jfreechart-1.0.15.jar ライブラリの両方をプロジェクトにインポートしました。

私が気付いたのは、このデモのためだけに完全な新しいプロジェクトを作成すると正常に動作しますが、それを既存のプロジェクトに組み込むと、このエラーが発生することです。

どんな助けでも大歓迎です!

ありがとう

ソースに移動すると

    public void setDirection(Rotation direction) {
    // <editor-fold defaultstate="collapsed" desc="Compiled Code">
    /* 0: new           #3                  // class java/lang/RuntimeException
     * 3: dup
     * 4: ldc           #4                  // String Uncompilable source code - cannot find symbol\n  symbol:   class Rotation\n  location: class org.jfree.chart.plot.PiePlot
     * 6: invokespecial #5                  // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
     * 9: athrow
     *  */
    // </editor-fold>
}
4

0 に答える 0