2012-06-11 5 views
0

에서 "해결할 수 없거나 필드가 없습니다."오류가 발생했습니다. Java 프로파일 러의 소스 코드를 Eclipse에 다운로드했습니다. 한 클래스에서 오류가 발생합니다.eclipse (java)

또한
t.threadLocalCCTNode cannot be resolved or is not a field 

getIndex 방법 라인 반환 Thread.currentThread().bytecodeIndex;에서, 그것은 비슷한주고있다 : 그것은 나에게 다음과 같은 오류를 제공 getCurrentNode 방법 라인 CCTNode node = t.threadLocalCCTNode;에서

/

** 
* Copyright (c) 2010 Aibek Sarimbekov, Philippe Moret, Walter Binder 
* 
* Permission to copy, use, modify (only the included source files, modification 
* of the binaries is not permitted) the software is granted provided this 
* copyright notice appears in all copies. 
* 
* This software is provided "as is" without express or implied warranty, and 
* with no claim as to its suitability for any purpose. 
*/ 
package ch.usi.dag.jp2.runtime; 

import ch.usi.dag.jborat.runtime.DynamicBypass; 

public class JP2Runtime { 
    private static final String objectConstructorMID; 
    private static final String currentThreadMID; 

    static CCTNode main; 

    static { 
     objectConstructorMID = "Ljava/lang/Object;.<init>()V".intern(); 
     currentThreadMID = "Ljava/lang/Thread;.currentThread()Ljava/lang/Thread".intern(); 
    } 

    public static CCTNode getCurrentNode() { 
     boolean old = DynamicBypass.getAndSet(); 
     try { 
      Thread t = Thread.currentThread(); 
      CCTNode node = t.threadLocalCCTNode; 

      if (node == null) { 
       node = CCTNode.getRoot(); 
       t.threadLocalCCTNode = node; 
       main = node; 
      } 
      return node; 
     } finally { 
      DynamicBypass.set(old); 
     } 
    } 

    public static void setCurrentNode(CCTNode node) { 
     boolean old = DynamicBypass.getAndSet(); 
     try { 
      Thread.currentThread().threadLocalCCTNode = node; 
     } finally { 
      DynamicBypass.set(old); 
     } 
    } 

    public static void setIndex(int index) { 
     boolean old = DynamicBypass.getAndSet(); 
     try{ 
      Thread.currentThread().bytecodeIndex = index; 
     } 
     finally{ 
      DynamicBypass.set(old); 
     } 
    } 

    public static int getIndex() { 
     boolean old = DynamicBypass.getAndSet(); 
     try { 
      return Thread.currentThread().bytecodeIndex;} 
     finally { 
      DynamicBypass.set(old); 
     } 
    } 
    public static void enableProfiling(){ 
     boolean old = DynamicBypass.getAndSet(); 
     try { 
      Thread.currentThread().activateBytecodeCounting=true; 
     } 
     finally { 
      DynamicBypass.set(old); 
     } 
    } 
    public static void disableProfiling(){ 
     boolean old = DynamicBypass.getAndSet(); 
     try { 
      Thread.currentThread().activateBytecodeCounting=false; 
     } 
     finally { 
      DynamicBypass.set(old); 
     } 
    } 

    public static CCTNode invokeProfileInvocation(CCTNode oldNode, String MID, int numberOfBB) { 
     boolean old = DynamicBypass.getAndSet(); 
     int bytecodeIndex = getIndex(); 
     try { 
       CCTNode n = oldNode.profileCall(MID, bytecodeIndex, numberOfBB); 
       Thread.currentThread().threadLocalCCTNode=n; 
      return n; 

     } finally { 
      DynamicBypass.set(old); 
     } 
    } 
    public static void invokeProfileInvocationForObjectConstructor(CCTNode oldNode) { 
     boolean old = DynamicBypass.getAndSet(); 
     int bytecodeIndex = getIndex(); 
     try { 
       CCTNode n = oldNode.profileCall(objectConstructorMID, bytecodeIndex, 1); 

       CCTNode.bbSizes.put(objectConstructorMID, allocateNewArrayWithOneElement()); 
     } finally { 
      DynamicBypass.set(old); 
     } 
    } 
    public static void invokeProfileInvocationForCurrentThread(CCTNode oldNode) { 
     boolean old = DynamicBypass.getAndSet(); 
     int bytecodeIndex = getIndex(); 
     try { 
       CCTNode n = oldNode.profileCall(currentThreadMID, bytecodeIndex, 1); 

       CCTNode.bbSizes.put(currentThreadMID, allocateNewArrayWithOneElement()); 
     } finally { 
      DynamicBypass.set(old); 
     } 
    } 
    private static int[] allocateNewArrayWithOneElement() { 
     int[] array = {1}; 
     return array; 
    } 
} 

: 클래스는 다음과 같습니다 다음과 같은 오류 :

bytecodeIndex cannot be resolved or is not a field 

시체가 잘못되었다고 말해줘? 이미 프로젝트 정리를 시도했지만 도움이되지 않았습니다 ..

감사합니다.

답변

0

코드가 객체 필드에 액세스하려고하지만 객체의 클래스가 해당 필드를 정의하지 않는다는 의미입니다.

tThread이며 API의 Thread 클래스 일 가능성이 높습니다. 내 ararchnid 감각은 오래된 Java 버전을 사용하고 있음을 나타냅니다.

코드 페이지를 확인하고 필요한 JDK/JRE 버전이 나와 있는지 확인하십시오.

+0

답변 해 주셔서 감사합니다. 명령 프롬프트에서 프로파일 러를 실행할 수있었습니다. 따라서 Eclipse에서 사용하는 java 버전은 프로파일 러에서 지원하지 않을 수 있습니다. – Ragini