peter-lawrey / HugeCollections-OLD

Huge Collections for Java using efficient off heap storage
273 stars 51 forks source link

setSegments(int) is not public in HugeConfig; cannot be accessed from outside package #20

Closed gilfernandes closed 10 years ago

gilfernandes commented 10 years ago

Hello,

I was just playing around with the examples and I got surprised by this error message on this code:

package com.onepointltd.file.operations;

...

@Test
    public void testHugeMap() {
        HugeConfig config = HugeConfig.DEFAULT.clone()
                .setSegments(128)
                .setSmallEntrySize(128)
                .setCapacity(10000);
    }

I get these error messages:

setSegments(int) is not public in HugeConfig; cannot be accessed from outside package

setSmallEntrySize(int) is not public in HugeConfig; cannot be accessed from outside package

setCapacity(int) is not public in HugeConfig; cannot be accessed from outside package

My current maven dependency is:

<dependency>
            <groupId>net.openhft</groupId>
            <artifactId>collections-sandbox</artifactId>
            <version>3.0.3-SNAPSHOT</version>
            <type>jar</type>
        </dependency>

If this is really a stupid question, please bare with me. I am just a beginner using OpenHFT.

Best regards,

Gil

peter-lawrey commented 10 years ago

This is an oversight. I will fix this today. On 2 May 2014 13:00, "gilfernandes" notifications@github.com wrote:

Hello,

I was just playing around with the examples and I got surprised by this error message on this code:

package com.onepointltd.file.operations; ... @Test public void testHugeMap() { HugeConfig config = HugeConfig.DEFAULT.clone() .setSegments(128) .setSmallEntrySize(128) .setCapacity(10000); }

I get these error messages:

setSegments(int) is not public in HugeConfig; cannot be accessed from outside package

setSmallEntrySize(int) is not public in HugeConfig; cannot be accessed from outside package

setCapacity(int) is not public in HugeConfig; cannot be accessed from outside package

My current maven dependency is:

net.openhft collections-sandbox 3.0.3-SNAPSHOT jar

If this is really a stupid question, please bare with me. I am just a beginner using OpenHFT.

Best regards,

Gil

— Reply to this email directly or view it on GitHubhttps://github.com/OpenHFT/HugeCollections/issues/20 .

RobAustin commented 10 years ago

Gil

Thanks for your feedback, we will definatly make the change that you suggest but I recommend you don’t use the code in collections-sandbox, Its’ our beta development area and contains work that is in progress. Its much better to use.

net.openhft collections 3.0.2

having said that, I think your comment about the visibility of these methods is an over site and we will correct this in the next release.

Rob

On 2 May 2014, at 13:00, gilfernandes notifications@github.com wrote:

Hello,

I was just playing around with the examples and I got surprised by this error message on this code:

package com.onepointltd.file.operations;

...

@Test public void testHugeMap() { HugeConfig config = HugeConfig.DEFAULT.clone() .setSegments(128) .setSmallEntrySize(128) .setCapacity(10000); } I get these error messages:

setSegments(int) is not public in HugeConfig; cannot be accessed from outside package

setSmallEntrySize(int) is not public in HugeConfig; cannot be accessed from outside package

setCapacity(int) is not public in HugeConfig; cannot be accessed from outside package

My current maven dependency is:

net.openhft collections-sandbox 3.0.3-SNAPSHOT jar

If this is really a stupid question, please bare with me. I am just a beginner using OpenHFT.

Best regards,

Gil

— Reply to this email directly or view it on GitHub.

gilfernandes commented 10 years ago

Hello, Rob,

I have tried:

git clone --branch collections-3.0.2 https://github.com/OpenHFT/HugeCollections.git

and

mvn clean install

Then I changed the dependency to:

<dependency>
            <groupId>net.openhft</groupId>
            <artifactId>collections</artifactId>
            <version>3.0.2</version>
        </dependency>

but the problem persists.

In the source code of HugeConfig I find:

HugeConfig setSmallEntrySize(int smallEntrySize) {
        this.smallEntrySize = Maths.nextPower2(smallEntrySize, 64);
        return this;
    }

...

HugeConfig setSegments(int segments) {
        this.segments = Maths.nextPower2(segments, 16);
        return this;
    }

And this code suggests that the setter methods are package protected.

But anyway I can use the collection, if I use only:

HugeConfig config = HugeConfig.DEFAULT.clone();

Anyway: I like your project very much and really appreciate your excellent work.

best regards,

Gil