/*
 * Copyright 2018, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.code;

import java.io.File;
import java.nio.file.Path;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Abstract base for source code files.
 */
public abstract class AbstractSourceFile extends FsObject {

    protected AbstractSourceFile(Path path) {
        super(path);
    }

    /**
     * Tells if this source file belongs to the passed directory.
     *
     * @param directory
     *         the passed instance must be a {@linkplain java.io.File#isDirectory() directory}
     * @return {@code true} if the file belongs to the directory,
     *         {@code false} if the directory does not exist, or the file is in another directory
     */
    public boolean isUnder(File directory) {
        checkNotNull(directory);

        if(!directory.exists()) {
            return false;
        }

        checkArgument(directory.isDirectory(), "%s is not a directory.", directory);

        String thisFile = getPath().toAbsolutePath()
                                   .toString();
        String dir = directory.getAbsolutePath();
        boolean result = thisFile.startsWith(dir);
        return result;
    }
}

@@ -1046,174 +1046,21 @@
 ava.
-io.File;%0Aimport java.nio.file.Path;%0A%0Aimport static com.google.common.base.Preconditions.checkArgument;%0Aimport static com.google.common.base.Preconditions.checkNotNull
+nio.file.Path
 ;%0A%0A/
@@ -1243,847 +1243,7 @@
    %7D
-%0A%0A    /**%0A     * Tells if this source file belongs to the passed directory.%0A     *%0A     * @param directory%0A     *         the passed instance must be a %7B@linkplain java.io.File#isDirectory() directory%7D%0A     * @return %7B@code true%7D if the file belongs to the directory,%0A     *         %7B@code false%7D if the directory does not exist, or the file is in another directory%0A     */%0A    public boolean isUnder(File directory) %7B%0A        checkNotNull(directory);%0A%0A        if(!directory.exists()) %7B%0A            return false;%0A        %7D%0A%0A        checkArgument(directory.isDirectory(), %22%25s is not a directory.%22, directory);%0A%0A        String thisFile = getPath().toAbsolutePath()%0A                                   .toString();%0A        String dir = directory.getAbsolutePath();%0A        boolean result = thisFile.startsWith(dir);%0A        return result;%0A    %7D
 %0A%7D%0A

Remove unused code