當前位置: 首頁>>代碼示例>>Java>>正文


Java XMethodParameter類代碼示例

本文整理匯總了Java中edu.umd.cs.findbugs.ba.XMethodParameter的典型用法代碼示例。如果您正苦於以下問題:Java XMethodParameter類的具體用法?Java XMethodParameter怎麽用?Java XMethodParameter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XMethodParameter類屬於edu.umd.cs.findbugs.ba包,在下文中一共展示了XMethodParameter類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitParameterAnnotation

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
@Override
public void visitParameterAnnotation(int p, String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) {
    if (database == null) {
        return;
    }

    NullnessAnnotation n = NullnessAnnotation.Parser.parse(annotationClass);
    annotationClass = lastPortion(annotationClass);
    if (n == null)
        return;

    XMethod xmethod = XFactory.createXMethod(this);
    if (DEBUG) {
        System.out.println("Parameter " + p + " @" + annotationClass.substring(annotationClass.lastIndexOf('/') + 1) + " in "
                + xmethod.toString());
    }
    XMethodParameter xparameter = new XMethodParameter(xmethod, p);

    database.addDirectAnnotation(xparameter, n);

}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:22,代碼來源:BuildNonNullAnnotationDatabase.java

示例2: getResolvedAnnotation

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
public NullnessAnnotation getResolvedAnnotation(Object o, boolean getMinimal) {
    Profiler profiler = Global.getAnalysisCache().getProfiler();
    profiler.start(this.getClass());
    try {

        if (DEBUG) {
            System.out.println("getResolvedAnnotation: o=" + o + "...");
        }

        TypeQualifierAnnotation tqa = null;

        if (o instanceof XMethodParameter) {
            XMethodParameter param = (XMethodParameter) o;

            tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(param.getMethod(),
                    param.getParameterNumber(), nonnullTypeQualifierValue);
        } else if (o instanceof XMethod || o instanceof XField) {
            tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o,
                    nonnullTypeQualifierValue);
        }

        NullnessAnnotation result = toNullnessAnnotation(tqa);
        if (DEBUG) {
            if (result == null)
                System.out.println("   ===> not found");
            else
                System.out.println("   ===> " + tqa + "/" + result.toString() );
        }
        return result;
    } finally {
        profiler.end(this.getClass());
    }
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:34,代碼來源:TypeQualifierNullnessAnnotationDatabase.java

示例3: getPassedAsNonNullParameter

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
public static PointerUsageRequiringNonNullValue getPassedAsNonNullParameter(final XMethod m, final int param) {
    return new PointerUsageRequiringNonNullValue() {
        @Override
        public @CheckForNull
        XMethodParameter getNonNullParameter() {
            return new XMethodParameter(m, param);
        }

        @Override
        public String getDescription() {
            return "SOURCE_LINE_INVOKED";
        }

    };
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:16,代碼來源:PointerUsageRequiringNonNullValue.java

示例4: getDirectAnnotation

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
public @CheckForNull NullnessAnnotation getDirectAnnotation(Object o) {
    Profiler profiler = Global.getAnalysisCache().getProfiler();
    profiler.start(this.getClass());
    try {

        if (DEBUG) {
            System.out.println("getDirectAnnotation: o=" + o + "...");
        }

        TypeQualifierAnnotation tqa = null;

        if (o instanceof XMethodParameter) {
            XMethodParameter param = (XMethodParameter) o;
            tqa = TypeQualifierApplications.getDirectTypeQualifierAnnotation(param.getMethod(),
                    param.getParameterNumber(), nonnullTypeQualifierValue);
        } else if (o instanceof XMethod || o instanceof XField) {
            tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o,
                    nonnullTypeQualifierValue);
        }

        NullnessAnnotation result = toNullnessAnnotation(tqa);
        if (DEBUG) {
            if (result == null)
                System.out.println("   ===> not found");
            else
                System.out.println("   ===> " + tqa + "/" + result.toString() );
        }
        return result;
    } finally {
        profiler.end(this.getClass());
    }
}
 
開發者ID:OpenNTF,項目名稱:FindBug-for-Domino-Designer,代碼行數:33,代碼來源:TypeQualifierNullnessAnnotationDatabase.java

示例5: initEntryFact

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
public void initEntryFact(IsNullValueFrame result) {
    if (cachedEntryFact == null) {

        cachedEntryFact = createFact();
        cachedEntryFact.setValid();

        int numLocals = methodGen.getMaxLocals();
        boolean instanceMethod = !methodGen.isStatic();
        XMethod xm = XFactory.createXMethod(methodGen.getClassName(), methodGen.getName(), methodGen.getSignature(),
                methodGen.isStatic());
        INullnessAnnotationDatabase db = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase();
        int paramShift = instanceMethod ? 1 : 0;
        Type[] argumentTypes = methodGen.getArgumentTypes();
        for (int i = 0; i < numLocals; ++i) {
            cachedEntryFact.setValue(i, IsNullValue.nonReportingNotNullValue());
        }
        if (paramShift == 1)
            cachedEntryFact.setValue(0, IsNullValue.nonNullValue());

        int slot = paramShift;
        for (int paramIndex = 0; paramIndex < argumentTypes.length; paramIndex++) {
            IsNullValue value;

            XMethodParameter methodParameter = new XMethodParameter(xm, paramIndex);
            NullnessAnnotation n = db.getResolvedAnnotation(methodParameter, false);
            if (n == NullnessAnnotation.CHECK_FOR_NULL)
                // Parameter declared @CheckForNull
                value = IsNullValue.parameterMarkedAsMightBeNull(methodParameter);
            else if (n == NullnessAnnotation.NONNULL)
                // Parameter declared @NonNull
                // TODO: label this so we don't report defensive programming
                value = false ? IsNullValue.nonNullValue()  : IsNullValue.parameterMarkedAsNonnull(methodParameter);
            else
                // Don't know; use default value, normally non-reporting
                // nonnull
                value = IsNullValue.nonReportingNotNullValue();

            cachedEntryFact.setValue(slot, value);

            slot += argumentTypes[paramIndex].getSize();
        }
    }
    copy(cachedEntryFact, result);
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:45,代碼來源:IsNullValueAnalysis.java

示例6: getNonNullParameter

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
public @CheckForNull
XMethodParameter getNonNullParameter() {
    return null;
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:5,代碼來源:PointerUsageRequiringNonNullValue.java

示例7: parameterMarkedAsMightBeNull

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
/**
 * Get instance representing a parameter marked as MightBeNull
 */
public static IsNullValue parameterMarkedAsMightBeNull(XMethodParameter mp) {
    return instanceByFlagsList[PARAM >> FLAG_SHIFT][NSP];
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:7,代碼來源:IsNullValue.java

示例8: parameterMarkedAsNonnull

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
/**
 * Get instance representing a parameter marked as Nonnull
 */
public static IsNullValue parameterMarkedAsNonnull(XMethodParameter mp) {
    return instanceByFlagsList[PARAM >> FLAG_SHIFT][NN];
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:7,代碼來源:IsNullValue.java

示例9: visitSyntheticParameterAnnotation

import edu.umd.cs.findbugs.ba.XMethodParameter; //導入依賴的package包/類
@Override
public void visitSyntheticParameterAnnotation(int p, boolean runtimeVisible) {
    if (database == null) {
        return;
    }

    XMethod xmethod = XFactory.createXMethod(this);

    XMethodParameter xparameter = new XMethodParameter(xmethod, p);

    database.addDirectAnnotation(xparameter, NullnessAnnotation.UNKNOWN_NULLNESS);

}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:14,代碼來源:BuildNonNullAnnotationDatabase.java


注:本文中的edu.umd.cs.findbugs.ba.XMethodParameter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。