|
What this is
Other links
The source code/******************************************************************************* * Copyright (c) 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package component.a; import component.a.internal.InternalClass; /** * Leaks an internal class in API */ public class LeakInternalClass { public A safeField; /** * No leak for default protection */ InternalClass safeDefaultField; /** * Leak a protected field to subclasses */ protected InternalClass leakProtectedField; /** * Leaking */ public InternalClass leakPublicField; /** * Private field cannot be seen, and is not a leak */ private InternalClass privateAvoidsLeak; /** * Leaks an internal class in return type. */ public InternalClass leakReturnType() { return new InternalClass(); } /** * Safe */ public INoImplementInterface noLeaksHere(INoImplementInterface arg) { return arg; } /** * Leaks a parameter. */ public INoImplementInterface leakParameter(InternalClass leak) { return null; } /** * Private method avoids a leak. */ private void privateAvoidsParameterLeak(InternalClass noLeak) { } /** * Can be seen by subclasses. * * @return */ protected InternalClass protectedReturnTypeLeak() { return new InternalClass(); } /** * Leaks a parameter type. * * @param leak * @return */ protected INoImplementInterface protectedParameterLeak(InternalClass leak) { return null; } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.